View Full Version : Avatar in template
Gellpak
03-22-2005, 03:47 AM
I'm attempting to place the current user's avatar in a location in the header template, but the avatar variables I know fail to display the image. I tried adding the below code to the end of global.php but it didn't help. Any suggestions?
$bbuserinfo['user_avatar']="<img src='{$bbuserinfo['user_avatar']}' alt='Edit Your Avatar' border='0'>";
$bbuserinfo['user_avatar']="<a href='profile.php?{$session['sessionurl']}&do=editavatar'>{$bbuserinfo['user_avatar']}</a>";
$welcome_avatar=$bbuserinfo['user_avatar'];
filburt1
03-22-2005, 04:00 AM
I doubt it's related, but you shouldn't have that & after the sessionurl. The sessionurl adds it on its own, if it's necessary (and it would be & to be XHTML-compliant).
Zachery
03-22-2005, 04:09 AM
I'm attempting to place the current user's avatar in a location in the header template, but the avatar variables I know fail to display the image. I tried adding the below code to the end of global.php but it didn't help. Any suggestions?
$bbuserinfo['user_avatar']="<img src='{$bbuserinfo['user_avatar']}' alt='Edit Your Avatar' border='0'>";
$bbuserinfo['user_avatar']="<a href='profile.php?{$session['sessionurl']}&do=editavatar'>{$bbuserinfo['user_avatar']}</a>";
$welcome_avatar=$bbuserinfo['user_avatar'];
Single quotes don't fly in html for setting attributes.
<tag var="X"></tag>
AFAIK you will need to query the database in some form to get what you want.
Gellpak
03-22-2005, 04:22 PM
Got it. Here's the code. Place this in phpinclude_start
require_once('./includes/init.php');
require_once('./includes/functions_user.php');
$bbuserinfo['user_avatar']=fetch_avatar_url($bbuserinfo['userid']);
$bbuserinfo['user_avatar']="<img src='$vboptions[bburl]/{$bbuserinfo['user_avatar']}' border='0'>";
$bbuserinfo['user_avatar']="<a href='$vboptions[bburl]/profile.php?{$session['sessionurl']}&do=editavatar'>{$bbuserinfo['user_avatar']}</a>";
$welcome_avatar=$bbuserinfo['user_avatar'];
and then place $welcome_avatar where you want it to output the avatar.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.