Gives you the users browsing the forums only, like on this forums’ “users online” or the “active users” on the tracker.
You need to create another field in the users table as follows:
ALTER TABLE 'users' ADD 'forum_access' DATETIME NOT NULL AFTER 'last_access' ; ALTER TABLE 'users' ADD INDEX ( 'forum_access' ) ; //upto you IF you do this step!
In forums.php find at around line 1491::
$forums_res = mysql_query("SELECT * FROM forums ORDER BY sort, name") or sqlerr(__FILE__, __LINE__); stdhead("Forums"); print("<h1>Forums</h1>\n");
Above that add:
mysql_query("UPDATE users SET forum_access='" . get_date_time() . "' WHERE id={$CURUSER["id"]}");// or die(mysql_error());
Find on around line 1590:
print("</table>\n"); print("<p align="center"><a href="?action=search"><b>Search</b></a> | <a href="?action=viewunread"><b>View unread</b></a> | <a href="?catchup"><b>Catch up</b></a></p>");
Add after that:
$forum_t = gmtime() - 600; //you can change this value to whatever span you want $forum_t = sqlesc(get_date_time($forum_t)); $res = mysql_query("SELECT id, username, class FROM users WHERE forum_access >= $forum_t ORDER BY forum_access DESC") or print(mysql_error()); while ($arr = mysql_fetch_assoc($res)) { if ($forumusers) $forumusers .= ",\n"; switch ($arr["class"]) { case UC_SYSOP: case UC_ADMINISTRATOR: case UC_MODERATOR: $arr["username"] = "<font color="orange">{$arr["username"]}</font>"; break; case UC_UPLOADER: $arr["username"] = "<font color="#4040C0">{$arr["username"]}</font>"; break; } if ($CURUSER) $forumusers .= "<a><b>{$arr["username"]}</b></a>"; } if (!$forumusers) $forumusers = "There have been no active users in the last 15 minutes."; ?> <br> <table width="50%" border="1" cellspacing="0" cellpadding="5"><tr> <td class="colhead" align="left">Active Forum Users</td></tr> </tr><td class="text"> </td></tr></table>
If the last entries after the above is stdfoot(); ?> then you need to open a php tag before it like
No Comment Received
Leave A Reply