What I want to do is recovering the avatar picture the Avatar Selection module generates, and present it elsewhere in my Drupal installation, specifically in pages where it is not appearing.

I have been referred to the dsm() function, but not being a programmer, I am utterly lost with this. I haven't got a clue.
I know that I need to know the field's name, where the picture is showing and then I can render it, but while I know all this, I have no clue as how to do it or if this is all I need.

I haven't found (or haven't understood) any dsm() tutorials out there.


First off, dsm(). You have to install a devel module. In you code if you do dsm($user) then it would show you a nice user interface of the $user object/array

Drupal user object

The location to the user picture (or avatar) is in your $user->picture object. If $user array is not available, then you can do global $user;

  • Thank you so much, iStryker. And do I paste "dsm($user)", for instance, in the part that resembles the body in an html page? – MauF Jul 19 '11 at 21:37
  • To display what is in the image, then yes – iStryker Jul 19 '11 at 21:46
  • Well, you definitely pointed me in the right direction. I have an output that shows the path of the image, but not the image, so I guess I'll get it eventually. I used "picture", but I'm missing something then. – MauF Jul 19 '11 at 21:55
  • $html_picture = theme('image', array('path' => $user->picture, 'alt' => $alt, 'title' => $title) you'll have to define $title & $alt. – iStryker Jul 19 '11 at 22:15
  • I see. Being that this is very Drupal-oriented, is there a PHP parallel that I could study or learn to understand how this works from the beginning? Thank you very much, indeed. – MauF Jul 19 '11 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.