After reading the documentation, it seems that the correct way of doing that is like this:
<?php print $user_picture; ?>
Wich won´t work (it doesn´t print anything at all).
After asking around, I get this answer, which sadly won't work either:
<?php global $user;
$image = theme('user_picture', $user);
print $image;?>
That code was suggested as a "last resource", but when I try to use it, I get this error message:
Fatal error: Cannot use object of type stdClass as array in /includes/theme.inc on line 1054
Looking for that particular line: if (isset($variables['#theme']) || isset($variables['#theme_wrappers'])) {
, and in context:
if (isset($variables['#theme']) || isset($variables['#theme_wrappers'])) {
$element = $variables;
$variables = array();
if (isset($info['variables'])) {
foreach (array_keys($info['variables']) as $name) {
if (isset($element["#$name"])) {
$variables[$name] = $element["#$name"];
}
}
}
It's pretty clear that it should work, but it doesn't.
Using contemplate module, I get this output as an alternative:
<?php print $node->picture ?>
Which won't work either.
I've tried then with Devel module (using the /devel tab of the node):
I get this:
picture (String, 4 characters ) 2876
$...->picture
Which won't work, because the output is just "2876", but is the only "picture" there.
So what can I do? How can I trace this problem?
note that
theme('user_picture', $vars);
is a tpl.php file. you can dpm($vars) of a preprocess function for this theme function and see what you can use.