The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
I've gotten X7 chat set up and am trying to add a "Currently In Chat" info area, like the "Currently Active Users". I have it all set up and am trying to get the following to work. vBulletin isn't pulling this information like it does on my chat page. I want people reading the forums to be able to see who is chatting from the forum.
Do I need to create a variable? <?include_once("chatonline.php");list_totals();? > <?include_once("chatonline.php");list_members(" - ");?> Once I can get this to work I'll create a thread with everything I've done so that other people can use the information and set up X7, a really nice chat. This is what the current code looks like in the edited forumhome, I've bolded the code I'm having a problem with: Code:
<!-- who's in chat -->
<tbody>
<tr>
<td class="thead" colspan="2">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_activeusers')"><img id="collapseimg_forumhome_activeusers" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_activeusers].gif" alt="" border="0" /></a>
<a href="chatonline.php">Currently In Chat: <?("chatonline.php");list_totals();?></a>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td class="alt2"><a href="chatonline.php"><img src="chatonline.gif" alt="View Who's Chatting" border="0" /></a></td>
<td class="alt1" width="100%">
<div class="smallfont">
<div><?include_once("chatonline.php");list_members(" - ");?></div>
</div>
</td>
</tr>
</tbody>
<!-- end who's in chat -->
Any help with getting this working will be much appreciated and credited when I post the X7 sort of mod
|
|
#2
|
|||
|
|||
|
More info, here is the code in the chatonline.php that is being called:
Code:
<?
function who_is_in_chat(){
// MySql Information
$user = ""; // Your MySql username
$pass = ""; // Your MySql password
$db = ""; // Your MySql Database
$prefix = "X7Chat_"; // Your table prefix
$expire_time = 240; // The amount of seconds that users can be idle before they are considered offline
// This value is setable in the X7 Chat admin panel, you must also set it here.
// If the values do not match then the scripts may be inaccurate.
// No more editing required
mysql_connect("localhost",$user,$pass);
mysql_select_db($db);
$exp_time = time()-$expire_time;
$q = mysql_query("DELETE FROM {$prefix}online WHERE time<'$exp_time'");
$q = mysql_query("SELECT username FROM {$prefix}online");
$results = array();
while($row = mysql_fetch_row($q))
$results[] = $row[0];
return $results;
}
function list_totals(){
echo count(who_is_in_chat());
}
function list_members($sep=", "){
$online = who_is_in_chat();
echo implode($sep,$online);
}
?>
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|