MyBB Community Forums
Adding user avatar to header template? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Themes (https://community.mybb.com/forum-103.html)
+---- Forum: Theme Support (https://community.mybb.com/forum-10.html)
+---- Thread: Adding user avatar to header template? (/thread-125843.html)



Adding user avatar to header template? - MRKH - 2012-09-08

I am currently attempting to add the users avatar to my header template (below nav bar) with the code {$avatar} but nothing shows up. Anyone can help me make it show up?


RE: Adding user avatar to header template? - Frank.Barry - 2012-09-08

Use this:

<img src="{$mybb->user['avatar']}"/>



RE: Adding user avatar to header template? - MRKH - 2012-09-08

(2012-09-08, 06:25 PM)Frank.Barry Wrote: Use this:

<img src="{$mybb->user['avatar']}"/>

Thanks it works, solved.


RE: Adding user avatar to header template? - VisualizeEdits - 2016-08-09

Does this work with 1.8? Can anyone confirm this for me?


RE: Adding user avatar to header template? - iAndrew - 2016-08-09

Add both of these to your members template, it will use a default avatar for people who haven't uploaded one.

<a class="header_avatar" href="{$mybb->settings['bburl']}/usercp.php?action=avatar"><img src="{$mybb->user['avatar']}" height="35px" width="35px" /></a>

<script>
$(document).ready(function() {
//create a default avatar for those without one.
if($('.header_avatar img', this).attr('src') == ''){
$('.header_avatar img').attr('src', "images/default_avatar.png");
}
});
</script>



RE: Adding user avatar to header template? - TheNightmarealm - 2020-06-04

gracias me sirvio para el tema vBulletin
https://community.mybb.com/thread-228127.html