2011-11-10, 02:11 AM
http://mods.mybb.com/view/ajax-chat-user-count
I downloaded this plugin and installed it, the PHP is:
How do I get the forum to return the number of users currently in chat?
I made a new navbar link by editing the 'header' and adding the link to the chat directory, the header now looks like:
Can someone please help?
I downloaded this plugin and installed it, the PHP is:
<?php
/*
Ajax-Chat User-Count Plugin for MyBB
Copy this file into your plugins directory and activate in the admin control panel
*/
if(!defined("IN_MYBB")) {
die("This file cannot be accessed directly.");
}
$plugins->add_hook('index_start','ajaxchatusercount',1000);
$plugins->add_hook('global_start','ajaxchatusercount',1000);
function ajaxchatusercount_info() {
return array(
'name' => 'ajaxchatusercount',
'description' => 'AjaxChat User Count',
'website' => 'mailto:[email protected]',
'author' => 'fwalderd',
'authorsite' => 'mailto:[email protected]',
'version' => '0.1',
'compatibility' => '16*'
);
}
function ajaxchatusercount_activate() {
// global $db, $mybb;
}
function ajaxchatusercount_deactivate() {
// global $db,$mybb;
}
function ajaxchatusercount() {
global $ajaxchatusercount,$db,$mybb;
//Count Users in Ajax Chat and return a string: Chat(x)
$query=$db->query("SELECT userID FROM ajax_chat_online");
$usercount=0;
while($record=$db->fetch_array($query)) {
$usercount=$usercount+1;
}
//If you want a different output, edit the line below
$ajaxchatusercount="Chat <strong>(".$usercount.")</strong>";
}
?>
How do I get the forum to return the number of users currently in chat?
I made a new navbar link by editing the 'header' and adding the link to the chat directory, the header now looks like:
<li><a href="{$mybb->settings['bburl']}/calendar.php">{$lang->toplinks_calendar}</a></li>
<li><a href="{$mybb->settings['bburl']}/misc.php?action=help">{$lang->toplinks_help}</a></li>
<li><a href="{$mybb->settings['bburl']}/chat">Chat</a></li>
Can someone please help?