Here's the code that displays the avatar in the postbit:
PHP Code:
// get avatar
if ($this->post['avatarid'])
{
$this->post['avatarurl'] = $this->post['avatarpath'];
}
else
{
if ($this->post['hascustomavatar'] AND $this->registry->options['avatarenabled'])
{
if ($this->registry->options['usefileavatar'])
{
$this->post['avatarurl'] = $this->registry->options['avatarurl'] . '/avatar' . $this->post['userid'] . '_' . $this->post['avatarrevision'] . '.gif';
}
else
{
$this->post['avatarurl'] = 'image.php?' . $this->registry->session->vars['sessionurl'] . 'u=' . $this->post['userid'] . '&dateline=' . $this->post['avatardateline'];
}
if ($this->post['avwidth'] AND $this->post['avheight'])
{
$this->post['avwidth'] = 'width="' . $this->post['avwidth'] . '"';
$this->post['avheight'] = 'height="' . $this->post['avheight'] . '"';
}
else
{
$this->post['avwidth'] = '';
$this->post['avheight'] = '';
}
}
else
{
$this->post['avatarurl'] = '';
}
}
if ( // no avatar defined for this user
empty($this->post['avatarurl'])
OR // visitor doesn't want to see avatars
($this->registry->userinfo['userid'] > 0 AND !$this->registry->userinfo['showavatars'])
OR // user has a custom avatar but no permission to display it
(!$this->post['avatarid'] AND !($this->cache['perms'][$this->post['userid']]['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['canuseavatar']) AND !$this->post['adminavatar']) //
)
{
$show['avatar'] = false;
}
else
{
$show['avatar'] = true;
}
You could use that by calling $userinfo = fetch_userinfo($lastpid, FETCH_USERINFO_AVATAR), then using $userinfo in place of $this->post in the above code. One difference is that it looks like the above code allows for no avatar at all instead of giving everyone the default. Also it allows for the "viewing" user having selected the option to not see avatars.
Edit: Also use $vbulletin in place of $this->registry.