Here is the basic code :
- Code: Select all
<?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:felix@walderdorff.org',
'author' => 'fwalderd',
'authorsite' => 'mailto:felix@walderdorff.org',
'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>";
}
?>
Can I modify or create something similar for phpfreechat????