PDA

View Full Version : How can I add the user's avatar to the header


rnbjunk
03-17-2010, 04:18 PM
I want to add the user's avatar (if he or she is logged in) to the header template, how can I find the avatar's url?

Thanks

serg472
05-14-2010, 08:24 PM
I would like to know this as well. Any thoughts?

--------------- Added 1273875943 at 1273875943 ---------------

Ok that's what I ended up doing if anyone interested. It requires a file modification but works so far. Maybe someone can suggest a better solution.

open:
/forum/includes/init.php

find:
$vbulletin->userinfo =& $vbulletin->session->fetch_userinfo();

add below:
require_once(DIR . '/includes/functions_user.php');
fetch_avatar_from_userinfo($vbulletin->userinfo);


use in header template:
<img src="<vb:if condition="$bbuserinfo['avatarurl'] != '/unknown.gif'">/forum/{vb:raw bbuserinfo.avatarurl}<vb:else />/forum/images/misc/unknown.gif</vb:if>" alt="{vb:raw bbuserinfo.username}'s Avatar"/>


add plugin on "init_startup" with the following code:
define('AVATAR_ON_NAVBAR', true);