Hi, I want to set a color for certain groups so that visitors can see in the "Online Stats" feature what group a user belongs to. Like regular Registered Members are black but users under Administrators are red. I've seen this done in forums and I was wondering if there is a way to do this on a coppermine gallery that is not bridged to a forum?
Related to the onlinestats plugin, moving accordingly.
Open plugin/onlinestats/codebase.php
Find:
$result = cpg_db_query("SELECT user_id, user_name FROM {$CONFIG['TABLE_ONLINE']} WHERE user_id <> 0");
$logged_in_array = array();
while ($row = mysql_fetch_row($result)) {
$logged_in_array[] = vsprintf('<a href="profile.php?uid=%d">%s</a>', $row);
}
Replace with:
$result = cpg_db_query("SELECT o.user_id, o.user_name, u.user_group FROM {$CONFIG['TABLE_ONLINE']} o INNER JOIN {$CONFIG['TABLE_USERS']} u ON o.user_id = u.user_id WHERE o.user_id <> 0");
$logged_in_array = array();
while ($row = mysql_fetch_row($result))
{
switch($row[2])
{
case 1: $color = "#FF0000"; break;
case 2: $color = "#00FF00"; break;
case 3: $color = "#0000FF"; break;
}
$logged_in_array[] = vsprintf('<a href="profile.php?uid=%d"><font color="'.$color.'">%s</font></a>', $row);
}
In the switch-statement you can set the different colors for the group id's.
That works perfect, thanks!