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).

Afetr asking around, I get this answer, wich 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 ?>

Wich 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

Wich 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?

Thanks for your help!

Comments

vm’s picture

does it work in a core theme, which would already have the proper variable?

and you are clearing cache after altering a tpl.php file?

Rosamunda’s picture

Yes, and still won´t work.
I mean, I´ve set the default as Bartik, and it still won´t print it out.
And I clear manually cache, besides having the devel option rebuild the theme registry on.
Thanks for your reply!

ps. I´m using an Omega subtheme.

nevets’s picture

May be a silly question but do you have user pictures enabled and do any users have a picture?

Rosamunda’s picture

Yes I have. And I´ve created a new user to check this and uploaded a picture (that´s normally shown in his profile page).
But I´ve authored a node with that user and I can´t get the picture there...
Note: I´ve make sute that the option is checked both in the global settings and my theme settings aswell.

jaypan’s picture

Look at the HTML source to see if the URL is being properly outputted by Drupal. Maybe the path is wrong, or maybe you have a file configuration issue.

Contact me to contract me for D7 -> D10/11 migrations.

vm’s picture

permissions on the folder that was created for user pictures should also be inspected.

Rosamunda’s picture

Perms seems to be ok (755). And those images are actually printed out, but only in the profile page.
The html outputted ignores it completely. It is as if I haven´t printed any profile image of the user (I´ve print $user_picture;).

I´ve have the output of dsm($content) (dsm($node) results in nothing) here: http://imageshack.us/photo/my-images/69/issuej.jpg/