Upgraded for v2.08
begin_frame( T_("ONLINE_USERS_TODAY") );
$expires = 900; // Cache time in seconds
if (($rows = $TTCache->Get("usersonlinetoday_block", $expires)) === false) {
$res = SQL_Query_exec("SELECT id, username, class, donated, warned FROM users WHERE enabled = 'yes' AND status = 'confirmed' AND privacy !='strong' AND UNIX_TIMESTAMP('".get_date_time()."') - UNIX_TIMESTAMP(users.last_access) <= 86400");
$rows = array();
while ($row = mysql_fetch_assoc($res)) {
$rows[] = $row;
}
$TTCache->Set("usersonlinetoday_block", $rows, $expires);
}
if (!$rows) {
echo T_("NO_USERS_ONLINE");
} else {
echo "<div id='uOnline' class='bMenu'><ul>n";;
for ($i = 0, $cnt = count($rows), $n = $cnt - 1; $i < $cnt; $i++) {
$row = &$rows[$i];
switch ( $row['class'] )
{
case 7:
$color = 'red';
break;
case 6:
$color = 'brown';
break;
case 5:
$color = 'yellow';
break;
case 4:
$color = 'purple';
break;
case 3:
$color = 'gold';
break;
case 2:
$color = 'blue';
break;
case 1:
$color = 'green';
break;
}
$warned = null;
if ( $row['warned'] == 'yes' )
{
$warned = '<img src="images/warned.png" alt="Warned" title="Warned" border="0" />';
}
$donated = null;
if ($row['donated'] > 0)
{
$donated = '<img src="images/star.png" alt="Donated" title="Donated" border="0" />';
}
echo "<li><a href='account-details.php?id=$row[id]'><font style='color: ".$color."'>$row[username]</font> $warned $donated</a>".($i < $n ? ", " : "")."</li>n";;
}
echo "</ul></div>n";;
}
end_frame();
Add to languages/english.php before closing php tag
$LANG["ONLINE_USERS_TODAY"] = "Users Online Today";
Includes user class color, donated star for donators, warned pic for warned users... and of course if you use cooly's class_user function your better of copying the users online block from blocks and changing
UNIX_TIMESTAMP(users.last_access) <= 900
to
UNIX_TIMESTAMP(users.last_access) <= 86400
And changing
$row[username]
to
" . class_user($row["username"]) . "
