Back to vBulletin 4 Articles

Customizing VSa - Chatbox with user avatars
by MarkFL 09 Dec 2014
Rating: (4 votes - 5.00 average)

How to display user avatars. We use the file system to store our avatars, so could not use the image.php?u=userid method.

To show avatars open the plugin titled "VSa - ChatBox - MN" and locate the line:

PHP Code:
$vsacb_msg_box_parsed str_replace('\''''', $vsacb_bbparser->do_parse($vsacb_msg_box_styled,1,$vsacb_smilies_onoff,1,1,1)); 
And after that, inserted the code:

PHP Code:
require_once('./includes/functions_user.php');
$avatar_url fetch_avatar_url($vsacb_msg_box['userid']);

$avatar $avatar_url[0];

if (!
$avatar)
{
    
$avatar './images/misc/unknown.gif';
}

$user_avatar '<img src="'.$avatar.'" border="0" width="48" style="vertical-align: middle" />';

vB_Template::preRegister('vsa_chatbox_bit',array('user_avatar' => $user_avatar)); 
Save the plugin, and then in the template "vsa_chatbox_bit" you may use "{vb:raw user_avatar}" to display the user avatars.

vblts.ru supports vBulletin®, 2022-2024