We have a chat room with our Social Network site. We need to display on home & profile page how many people are in the chat room.
Below are the full instructions on how you do it so this will be a very easy job.
Need it done ASAP so please only bid if you can do it now.
Thanks
You will need to write a custom code that is similar to the site_statstics_chat() in the include/functions_chat.php:
// THIS FUNCTION IS RUN WHEN GENERATING SITE STATISTICS
// INPUT:
// OUTPUT:
function site_statistics_chat(&$args)
{
global $database;
$statistics =& $args['statistics'];
// NOTE: CACHING WILL BE HANDLED BY THE FUNCTION THAT CALLS THIS
$total = $database->database_fetch_assoc($database->database_query(“SELECT COUNT(chatuser_id) AS total FROM se_chatusers WHERE chatuser_lastupdate>”.(time()-15)));
$statistics['chat'] = array(
‘title’ => 3510042,
‘stat’ => (int) ( isset($total['total']) ? $total['total'] : 0 )
);
/*
$total = $database->database_fetch_assoc($database->database_query(“SELECT COUNT(chat_user_id) AS total FROM se_chat_users WHERE chat_user_session_lastupdate>”.(time()-15)));
$statistics['im'] = array(
‘title’ => 3510043,
‘stat’ => (int) ( isset($total['total']) ? $total['total'] : 0 )
);
*/
}
// END site_statistics_chat() FUNCTION
After doing that, please make sure the function is imported into the profile.php and you should call it and assign it as a smarty variable:
$chat_count = custom_stat_function();
$smarty->assign(‘chat_count’, $chat_count);
Then in your profile.tpl file you can call this variable with a code like this:
Chat count is equal to {$chat_count}