The only way to have a correct user list, is if you force your users to log out, from the chat session. If they do not, they session stays in the list (I think there is a time limit, after that the session is erased). Until it gets erased, you see them in the list.
I added a log out button in my forms, so that the users can log out. In the vBChat.php file, you need to add something like this:
Find:
PHP Code:
// ---------------------------------------------------
// Start Page Output
// ---------------------------------------------------
Above that, add:
PHP Code:
// ---------------------------------------------------
// Start Logout
// ---------------------------------------------------
if($_GET['do']=="logout")
{
$DB->query("delete from ".TABLE_PREFIX."session WHERE userid=$bbuserinfo[userid] AND location like '%vBChat.php%'");
eval('print_output("' . fetch_template('chat_close') . '");');
exit;
}
The template chat_close can be something like:
HTML Code:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript"><!--
function winClose() {
setTimeout('self.close()',8000);
}
//--></SCRIPT>
<title>$vboptions[bbtitle] - $pagetitle</title>
$headinclude
</HEAD>
<BODY>
$header
<br><br><br><br>
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat" colspan="3"><center>Thank you for using our Chat</center></td>
</tr>
<tr>
<td class="alt1"><CENTER>This window will now close.<br>Please come back at your convenience.</center></td>
</tr>
</table>
<SCRIPT LANGUAGE="JavaScript"><!--
//and at the end of the page place this call
winClose()
//--></SCRIPT>
</BODY>
</HTML>
I do that, because I have the chat open in a new window, which I want it to close after the user logs out.
As for the log out link, in your chat_main template, find:
HTML Code:
<b>Post Message:</b>
<input type='text' name='message' class='button' size='70'> <input type='submit' value=' Post ' class='button'>
</td>
Below that, add:
HTML Code:
<td align='right' class='tfoot'><a href='vBChat.php?$session[sessionurl]do=logout&u=$bbuserinfo[userid]'>
<input type="submit" class="button" name="logout" value="Log Out" accesskey="l" onClick="window.location='vBChat.php?$session[sessionurl]do=logout&u=$bbuserinfo[userid]'">
</a>
</td>