Get a Specific user's avatar Mybb :: Using Template Conditionals
#1
Hey gang, I just figured out how to get a specific user's uploaded avatar using template conditionals.

This has been bugging me forever, I have seen many people ask this question, "How can I get a specific user's avatar?"

This is how you do it using the get_user function, and the template conditionals plugin.

where 1 = the user I.d that you want to pull, for example, the user I.D below is 1


And here you go.

<setvar user1>get_user(1)</setvar>
<img class="my-pic" src="<func htmlspecialchars_uni>{$tplvars['user1']['avatar']}</func>">

Tested and works perfect, what do you think? I'm excited!

The avatar changes when the user changes their avatar. Shows default avatar as well.

Opinions? Feedback? Questions? Suggestions?

*add an img class if you desire, or height and width, now that you have the basics, the possibilities are yours for the making.
Hey man, what's up?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)