jamoss
04-18-2002, 10:00 PM
Below is a hack I modified to show the number of users in your integrated phpMyChat.
Requirements:
phpMyChat tables must be in the same database as vBulletin tables!
1. Add this code...
* If you want this to show up in your HEADER, you must add it to global.php
* If you want this to show up on the body of your home page, add it to index.php
~~~~~~~~~~~~~~~~
//CHAT USER COUNT
// Cleanup Old Users
// 240 = Wait 4 mins before deleteing inactive users
//CHAT DIRECTORY GOES HERE
$chatdir='./chat'
$DB_site->query("DELETE from c_users where u_time < ".(time() - 240)." and u_time > 0");
$numchattersa = $DB_site->query_first("SELECT count(username) AS username FROM c_users");
$numchatters = $numchattersa[username];
if ($numchatters==1) {
$membertext="member";
$istext="is";
}
else {
$membertext="members";
$istext="are";
}
$chatinfo = " There $istext <font color=red>$numchatters</font> $membertext in <a href=$chatdir/index.php3 >CHAT</a>";
//END CHAT USERS
~~~~~~~~~~~~~~~~
2. Add the variable $chatinfo in whatever template (spot) you want to put this phrase.
NOTES:
* It will use the correct english for all numbers - example:
There are 0 members in chat
There is 1 member in chat
There are 43 members in chat
* Example on http://www.babynames.com/boards
Cheers!
Jennifer.
Requirements:
phpMyChat tables must be in the same database as vBulletin tables!
1. Add this code...
* If you want this to show up in your HEADER, you must add it to global.php
* If you want this to show up on the body of your home page, add it to index.php
~~~~~~~~~~~~~~~~
//CHAT USER COUNT
// Cleanup Old Users
// 240 = Wait 4 mins before deleteing inactive users
//CHAT DIRECTORY GOES HERE
$chatdir='./chat'
$DB_site->query("DELETE from c_users where u_time < ".(time() - 240)." and u_time > 0");
$numchattersa = $DB_site->query_first("SELECT count(username) AS username FROM c_users");
$numchatters = $numchattersa[username];
if ($numchatters==1) {
$membertext="member";
$istext="is";
}
else {
$membertext="members";
$istext="are";
}
$chatinfo = " There $istext <font color=red>$numchatters</font> $membertext in <a href=$chatdir/index.php3 >CHAT</a>";
//END CHAT USERS
~~~~~~~~~~~~~~~~
2. Add the variable $chatinfo in whatever template (spot) you want to put this phrase.
NOTES:
* It will use the correct english for all numbers - example:
There are 0 members in chat
There is 1 member in chat
There are 43 members in chat
* Example on http://www.babynames.com/boards
Cheers!
Jennifer.