MyBB Community Forums

Full Version: Where can i put this code? lol
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
It probably won't work in mybb but if there is a way to put it in i would appreciate some help...

'CHAT_TITLE' => 'Online: '.htmlentities(implode(', ', $chat_online_user_names), ENT_QUOTES, 'UTF-8'),

It is part of madblueimp's code for the ajax chat.. I've done everything else to put the icon in the toplinks but i would really like to show the users in the chatroom next to the toplink if possible...

Is there are a way to do this? Or is there a way to put it into another area on the forums?

Here is madblueimps coding for the icon using PHPBB3

https://blueimp.net/forum/viewtopic.php?f=11&t=433

I greatly appreciate any help or suggestions you can offer Smile
That won't work =P What you can do, is adding a new count-query in global.php of the table 'ajax_chat_online'.

Ex.
FIND

// Run global_start plugin hook now that the basics are set up
$plugins->run_hooks("global_start");	

Add Below
// With MYBB Prefix
$chat_query = $db->simple_select(TABLE_PREFIX."ajax_chat_online", "COUNT(*) AS online", "");
// Without MYBB Prefix
// $chat_query = $db->simple_select("ajax_chat_online", "COUNT(*) AS online", ""); 
$chat_onlineusers = $db->fetch_field($chat_query, "online");
if($db->num_rows($chat_query) == 0)
{
       $chat_onlineusers = 0;
}

Then Open your header template

Add a new link
<li><a href="{$mybb->settings['bburl']}/<FILENAME>"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/<IMAGENAME>" alt="Chat" />Chat [{$chat_onlineusers}]</a></li>

Don't forget to change <FILENAME> and <IMAGENAME>
Excellent, thanks Lex! I have an error, i know why, it's because in the database the ajax_chat_online doesn't have the mybb_ before it like the rest of the tables.. Have you any idea how i could go around this?
Use this query,

$chat_query = $db->simple_select("ajax_chat_online", "COUNT(*) AS online", "");
That worked perfectly!! Thanks so much again Lex, you're awesome Big Grin
Dunno what it will show if there are no users =P probably just '[]'
Yea i think so but that's fine lol Smile
worked great thank you!

And if anyone needs DIY help ill be happy to help http://forum.hudsoncarpentry.co.uk
LeX-...could you please take a look at the rest of the code for displaying the online users on AJAX Chat ??? i would really appreciate it if you could figure out the code for displaying WHO is online on the chat! PLS !!! thnx in advance !!! Big Grin
i would also be interested in the whos online in chat but have it where the boards whos online is.

i tried my self an just got an error...
Pages: 1 2