Version: 1.00, by Zzed
Developer Last Online: Feb 2012
Version: 2.2.x
Rating:
Released: 04-28-2002
Last Update: Never
Installs: 5
No support by the author.
This is a really simple hack that displays the number of users browsing the current forum along
with the list of users.
It requires no template changes.
In forumdisplay.php
find:
PHP Code:
if ($showforumusers) {
$datecut = $ourtimenow - $cookietimeout;
$browsers = '';
$comma = '';
$forumusers = $DB_site->query("SELECT username, invisible, userid
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'];
if ($forumuser['invisible'] == 1) { // Invisible User but show to Admin
$invisibleuser = '*';
} else {
$invisibleuser = '';
}
eval("\$browsers .= \"".$comma.gettemplate('forumdisplay_loggedinuser')."\";");
$comma = ', ';
}
}
// Don't ask the DB for the user that is viewing the page as they wouldn't be here if they weren't! DOH!
// This way our query up above can hit the inforum index so don't change unless you know what you are doing.
if ((!$bbuserinfo['invisible'] or $bbuserinfo['usergroupid'] == 6) and $bbuserinfo['userid'] <> 0) {
$userid = $bbuserinfo['userid'];
$username = $bbuserinfo['username'];
if ($bbuserinfo['invisible'] == 1) { // Admin is invisible but show himself to himself, get it!
$invisibleuser = '*';
} else {
$invisibleuser = '';
}
eval("\$browsers .= \"".$comma.gettemplate('forumdisplay_loggedinuser')."\";");
}
if ($browsers) {
if (!$moderatedby) {
$onlineusers = "<br>";
}
eval("\$onlineusers .= \"".gettemplate('forumdisplay_loggedinusers')."\";");
}
}
And replace it with:
PHP Code:
if ($showforumusers) {
$datecut = $ourtimenow - $cookietimeout;
$browsers = '';
$comma = '';
$usercount = 0;
$forumusers = $DB_site->query("SELECT username, invisible, userid
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'];
if ($forumuser['invisible'] == 1) { // Invisible User but show to Admin
$invisibleuser = '*';
} else {
$invisibleuser = '';
}
eval("\$browsers .= \"".$comma.gettemplate('forumdisplay_loggedinuser')."\";");
$comma = ', ';
$usercount++;
}
}
// Don't ask the DB for the user that is viewing the page as they wouldn't be here if they weren't! DOH!
// This way our query up above can hit the inforum index so don't change unless you know what you are doing.
if ((!$bbuserinfo['invisible'] or $bbuserinfo['usergroupid'] == 6) and $bbuserinfo['userid'] <> 0) {
$userid = $bbuserinfo['userid'];
$username = $bbuserinfo['username'];
if ($bbuserinfo['invisible'] == 1) { // Admin is invisible but show himself to himself, get it!
$invisibleuser = '*';
} else {
$invisibleuser = '';
}
$usercount++;
eval("\$browsers .= \"".$comma.gettemplate('forumdisplay_loggedinuser')."\";");
}
if ($browsers) {
$browsers = "<b>($usercount users)</b> $browsers";
if (!$moderatedby) {
$onlineusers = "<br>";
}
eval("\$onlineusers .= \"".gettemplate('forumdisplay_loggedinusers')."\";");
}
}