Quote:
Originally Posted by Sarteck
In some areas there fetch_musername() is called, it doesn't send the UserFields along with the UserInfo. So you might want to check to make sure the field exists on the array, first.
PHP Code:
if (is_member_of($user, $special_group))
{
if (!array_key_exists('fieldXX', $user)) {$user = fetch_userinfo($user['userid']);}
$my_special_color = $user['fieldXX'];
$user['musername'] = '<span style="color:'.$my_special_color.'">'.$user['username'].'</span>';
}
|
If anyone happens to use this thread as a reference for anything, take note that I made a mistake here. Calling
fetch_userinfo() inside of the
fetch_musername hook is not a good idea. Instead, it should be written like this:
PHP Code:
if (is_member_of($user, $special_group))
{
if (!array_key_exists('fieldXX', $user))
{
global $vbulletin;
$tempuser = $vbulletin->db->query_first(sprintf("SELECT fieldXX FROM ".TABLE_PREFIX."userfield WHERE userid=%d",$user['userid']));
$user['fieldXX'] = $tempuser['fieldXX'];
}
$my_special_color = $user['fieldXX'];
$user['musername'] = '<span style="color:'.$my_special_color.'">'.$user['username'].'</span>';
}