Jump to the post that solved this thread.
Not Solved [How To?] How do I get user avatar on the index?
#1
Not Solved
Quote:<img src="{$mybb->user['avatar']}" alt="{$mybb->user['username']}" class="avatar" />

why wont this work?
Reply
#2
Not Solved
Do you mean you want avatars to appear on the forums? Like for the last poster in that forum?
Check out all my submissions here - click me
MyBB support at it's finest. 
Reply
#3
Not Solved
EDIT: Nevermind, you're right. I don't know why.
EDIT 2: Looks like at the end it has '/>'. I don't think it works in HTML5 anymore, and what I had used in mine was <img src="{$mybb->user['avatar']}" alt="{$mybb->user['username']}" class="avatar">.
Reply
#4
Not Solved
Your code should work really.

This is how you do this in MyBB in a proper way. Firstly you need to generate avatar in PHP.
$useravatar = format_avatar(htmlspecialchars_uni($mybb->user['avatar']), $mybb->user['avatardimensions'], my_strtolower('100x100'));

Then this is a template code.
<img src="{$useravatar['image']}" alt="" {$useravatar['width_height']} />

Maybe someone has better solution without meddling with PHP code, but it doesn't look like it. In global.php there's even no "avatar" word.
Reply
#5
Not Solved
(2015-02-16, 04:22 PM)mrnu Wrote: This is how you do this in MyBB in a proper way. First you need to generate avatar in PHP.

$useravatar = format_avatar(htmlspecialchars_uni($mybb->user['avatar']), $mybb->user['avatardimensions'], my_strtolower('100x100'));

Then this is a template code.

<img src="{$useravatar['image']}" alt="" {$useravatar['width_height']} />

Maybe someone has better solution without meddling with PHP code, but it doesn't look like it. In global.php there's even no "avatar" word.

This probably can work. I'll test it out for you.
EDIT: That isn't even working.
Reply
#6
Not Solved
top one is working, was moving JS around and for some reason it stopped working
Reply
#7
Not Solved
I recommend this
https://github.com/tommm/flpavatar

Fully working solution with cache
[MyBB 1.8 Czech translation] [MyBB 1.8 plugins]: Prune old PMs + optimize DB plugin --- Thank you/like system
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)