MyBB Community Forums

Full Version: How to get avatar on panel?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi all,

I know I had the variable to use the avatar of the logged user on the panel, but I can't seem to find it. Can somebody tell me what is it?

Thanks,
Combus
{$mybb->user['avatar']}

??
What matt posted, however you need to add {$mybb->settings['bburl']}/ in front of it as it's a relative path, then wrap it in image tags.
What if it's an external avatar?? I can't check right now but I think {$mybb->user['avatar']} would then be the full http:// URL to it, if you put {$mybb->settings['bburl']} in front it would break that; just having it start with images/ should still show it if it's locally hosted.
(2009-10-31, 04:01 PM)MattRogowski Wrote: [ -> ]What if it's an external avatar?? I can't check right now but I think {$mybb->user['avatar']} would then be the full http:// URL to it, if you put {$mybb->settings['bburl']} in front it would break that; just having it start with images/ should still show it if it's locally hosted.

Just using {$mybb->user['avatar']} should do it. Anything else will break url avatars.
Thanks all for your reply. I had it w/o the user on my mind Toungue
(2009-10-31, 04:01 PM)MattRogowski Wrote: [ -> ]What if it's an external avatar?? I can't check right now but I think {$mybb->user['avatar']} would then be the full http:// URL to it, if you put {$mybb->settings['bburl']} in front it would break that; just having it start with images/ should still show it if it's locally hosted.

Forgot about that. Just if you're in a subfolder it won't show.
One more question, is there anyway to set a default avatar to appear there in case the user didn't have one. Because it returns nothing, and therefore a broken image when there is no avatar set by the user.
If you put one in the ./images/avatars/ folder:

UPDATE `mybb_users` SET `avatar` = 'images/avatars/php.gif', `avatartype` = 'gallery', `avatardimensions` = '100|100' WHERE `avatar` = '';

Change the name/extension of the image, and change the dimensions. Then use the Default Profile plugin to set it for new users too.
Thanks Matt Smile
Pages: 1 2