Use this script;
PHP Code:
// ### You'll need the globals, but you probably already include this script so remove this line if you do!
require_once('./global.php');
// ### You'll need the user functions, remove this line if it's already begin called
require_once('./includes/functions_user.php');
// ### Just making sure it's not already set! ;)
unset($avatar_url, $avatar);
$show['avatar'] = false; // for the templates
// ### Is user logged in?
if ($vbulletin->userinfo['userid'])
{
// User logged in, so fetch avatar (one query)
$avatar_url = fetch_avatar_url($vbulletin->userinfo['userid']);
// If user has avatar set some vars
if (is_array($avatar_url)
{
$avatar['url'] = $avatar_url[0];
$avatar['size'] = $avatar_url[1];
$show['avatar'] = true;
}
}
and this in the template in question;
HTML Code:
<if condition="$show[avatar]">
<img src="$avatar[url]" border="0" $avatar[size] />
</if>