skerjean
06-04-2002, 07:54 PM
Hi,
I made a little hack to display 'users browing this forum' in different colors according to their usergroupid. It was working fine until I upgraded to vBulletin v2.2.6, but I can't find why.
Here's an abstract from my forumdisplay.php (from line 687):
// Get users browsing this forum
$onlineusers = '';
if ($showforumusers) {
$datecut = $ourtimenow - $cookietimeout;
$browsers = '';
$comma = '';
$forumusers = $DB_site->query("SELECT username, invisible, userid, usergroupid
FROM user
WHERE inforum = $foruminfo[forumid]
AND lastactivity > $datecut
AND lastvisit <> lastactivity");
while ($forumuser = $DB_site->fetch_array($forumusers)) {
if ((!$forumuser['invisible'] or $bbuserinfo['usergroupid'] == 6) and $bbuserinfo['userid'] != $forumuser['userid']) {
$userid = $forumuser['userid'];
// $username = $forumuser['username'];
// hack: highlight usergroups
if (($forumuser[usergroupid] == 6) or ($forumuser[usergroupid] == 9)) $username = "<b><font color=\"EED500\">$forumuser[username]</font></b>";
else if (($forumuser[usergroupid] == 5) or ($forumuser[usergroupid] == 7)) $username = "<b><font color=\"A0A0A0\">$forumuser[username]</font></b>";
else $username = "<b><font color=\"FFFFFF\">$forumuser[username]</font></b>";
// end hack
if ($forumuser['invisible'] == 1) { // Invisible User but show to Admin
$invisibleuser = '*';
} else {
$invisibleuser = '';
}
eval("\$browsers .= \"".$comma.gettemplate('forumdisplay_loggedinuser')."\";");
$comma = ', ';
}
}
I commented "$username = $forumuser['username'];" to replace it with the hack code.
Admin is usergroup 6 on my board (I did double-checked it) so it should be displayed in yellow (EED500). However, admins are still shown in white as are registered users. If I change "FFFFFF" to "FF000" in the else line, only registered users are shown in red, and admins are still in white.
So there's obviously something wrong with this, but I don't know what. I appreciate your help.
Thanks.
I made a little hack to display 'users browing this forum' in different colors according to their usergroupid. It was working fine until I upgraded to vBulletin v2.2.6, but I can't find why.
Here's an abstract from my forumdisplay.php (from line 687):
// Get users browsing this forum
$onlineusers = '';
if ($showforumusers) {
$datecut = $ourtimenow - $cookietimeout;
$browsers = '';
$comma = '';
$forumusers = $DB_site->query("SELECT username, invisible, userid, usergroupid
FROM user
WHERE inforum = $foruminfo[forumid]
AND lastactivity > $datecut
AND lastvisit <> lastactivity");
while ($forumuser = $DB_site->fetch_array($forumusers)) {
if ((!$forumuser['invisible'] or $bbuserinfo['usergroupid'] == 6) and $bbuserinfo['userid'] != $forumuser['userid']) {
$userid = $forumuser['userid'];
// $username = $forumuser['username'];
// hack: highlight usergroups
if (($forumuser[usergroupid] == 6) or ($forumuser[usergroupid] == 9)) $username = "<b><font color=\"EED500\">$forumuser[username]</font></b>";
else if (($forumuser[usergroupid] == 5) or ($forumuser[usergroupid] == 7)) $username = "<b><font color=\"A0A0A0\">$forumuser[username]</font></b>";
else $username = "<b><font color=\"FFFFFF\">$forumuser[username]</font></b>";
// end hack
if ($forumuser['invisible'] == 1) { // Invisible User but show to Admin
$invisibleuser = '*';
} else {
$invisibleuser = '';
}
eval("\$browsers .= \"".$comma.gettemplate('forumdisplay_loggedinuser')."\";");
$comma = ', ';
}
}
I commented "$username = $forumuser['username'];" to replace it with the hack code.
Admin is usergroup 6 on my board (I did double-checked it) so it should be displayed in yellow (EED500). However, admins are still shown in white as are registered users. If I change "FFFFFF" to "FF000" in the else line, only registered users are shown in red, and admins are still in white.
So there's obviously something wrong with this, but I don't know what. I appreciate your help.
Thanks.