Display UserPhoto in "Menu"

I wish to display the users' avatar/userphoto/profilepicture on the left side in the top menu if the user is logged in. I would also like the profilepicture to be a clickable link to the users' profile page.

Is this something that can be done in vanilla/themes/(my_theme)/views/default.master.php? Where do I begin?

AFter looking at your code above, I think you need to always use UserPhoto to avoid the case that the user does not have a photo. This function will call UserPhotoDefaultUrl if the property $User->Photo does not exist.

the only thing I was trying to get around was the specific width and height that didn't seem to match the 3 defined classes - small med large . But I like yours less typing.
although come to think of it css probably could based on some parent in the menu page, whatever that may be.

peregrine said:
the only thing I was trying to get around was the specific width and height that didn't seem to match the 3 defined classes - small med large . But I like yours less typing.
although come to think of it css probably could based on some parent in the menu page, whatever that may be.

You can, which is what the main style sheet does for you when in pass in that class.

You can also just change the thumb size in your configuration to avoid using the very large image:$Configuration['Garden']['Thumbnail']['Size']

mine defaults to 50, and I needed to use a thumbnail of 96px, so instead of changing the default thumb size to 100px or so, I just use the uploaded image and resize in CSS. This word work for me locally, but I would have to tell people to change their configuration to have theirs not look stretched....and hence just hardcoding in the 'p'.

Does anyone know how to fix the profile page loading the user image? It does not display anything if they use Gravatar or none at all.

Did you try it with session statements in? I beleieve it may have been missing a semi-colon after the echo.

A quick scan probably this might work. I haven't tried it, but it looks like it will execute what was suggested.
This might be easier for you to understand written this way.
All statements end in semi-colon and alll php statements must be inside php tags.

I don't know if above will show avatars, gravatars, vanillaicons but it should show userphoto. If this doesn't solve your problem, you can probably break out the userphoto fucntion and copy into your theme and modify accordingly (you will see /profile/0 in the userphotos function it to show the profile in functions.render.php.)

I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Both solutions worked well! I went for your last suggestion above because of the user avatar beeing displayed in right proportions without beeing stretched/skewed.
Thank you for your time, pregrine! I wish to bother you with one last question.

What is the exact code for displaying the users' username as a clickable link?
My code for displaying the username for now, is: <?php echo $Session->User->Name ?> in default.master.php.

This is a great Thread, I was looking for ways to make the user name in the menu display the user image instead of the text/name...Using this method gave me the avatar but not replacing the text link , just added it above the menu. I also pilfered the who's online plugin for snippets but my results have not been satisfactory

A pretty neat Smarty variable was assigned for this sort of stuff: {$User}. It's only accesible through the Smarty templates though, but the function can easily be rewritten so you can use it elsewhere:

I am able to add the image but what I get is the link not the image lmao Sometimes I get this stuff and sometimes I am lost....this is a php based theme not tpl or smarty. No themehooks except for the master.default.php .. That is where I am trying to put this stuff arg!