Not Solved Where can i put this code? lol
#1
Not Solved
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
Reply
#2
Not Solved
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>
Reply
#3
Not Solved
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?
Reply
#4
Not Solved
Use this query,

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

And if anyone needs DIY help ill be happy to help http://forum.hudsoncarpentry.co.uk
Reply
#9
Not Solved
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
Reply
#10
Not Solved
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...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)