The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Avatar in header template
I am trying to show the user's current avatar in the forum header (version 3.7). I used this code in my vB 3.6 setup, which displays the users' current avatar, or the default avatar if they do not have one or aren't logged in.
HTML Code:
<if condition="$vbulletin->userinfo['avatarid']"> <img src="$bbuserinfo[avatarpath]" alt="$bbuserinfo[username]'s Avatar" border="0" width="64" height="64" /> <else /> <if condition="$vbulletin->userinfo['hascustomavatar']"> <if condition="$vbulletin->options['usefileavatar']"> <a href="profile.php?do=editavatar"><img src="$vboptions[avatarurl]/avatar$bbuserinfo[userid]_$bbuserinfo[avatarrevision].gif" title="$bbuserinfo[username]'s Avatar" alt="Avatar" border="0" width="64" height="64" /></a> <else /> <a href="profile.php?do=editavatar"><img src="image.php?u=$bbuserinfo[userid]&dateline=$avatar[dateline]" title="$bbuserinfo[username]'s Avatar" alt="Avatar" border="0" width="64" height="64" /></a> </if> <else /> <a href="profile.php?do=editavatar"><img src="$stylevar[imgdir_misc]/noavatar.gif" alt="guestavatar.gif" title="No Avatar Specified" border="0" width="64" height="64" /></a> </if> </if> Any help on fetching the users current avatar in the header template? Thanks, Freek |
#2
|
||||
|
||||
You'll find a clue in class_core.php (vB_Session constructor).
With your code, you would've needed a plugin to fetch the data - the data isn't there by default. |
#3
|
|||
|
|||
Ah
My code works a 100% with this line added in the config.php file: define('AVATAR_ON_NAVBAR', 1); |
#4
|
||||
|
||||
See, a bit of searching and you get a solution . Also, you don't have to have that code in config.php - you can have it in a plugin at init_startup. Furthermore, consider using the function fetch_avatar_from_userinfo, rather than putting all the logic in your templates.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|