1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Please donate today & help us with our growing server costs or buy premium for access to our premium products
    Dismiss Notice

Customizing VSa - Chatbox with user avatars

Discussion in 'Vbulletin' started by Deviant, May 9, 2016.

  1. Deviant

    Deviant Administrator Staff Member ADMIN

    Likes Received:
    141
    Trophy Points:
    43
    Gender:
    Male
    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:

    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:

    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.
     

Share This Page

Post thread