MyBB Community Forums

Full Version: AJAX Chat - including MyBB integration
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
It works! Thank you =)
Hey, got the chat installed and it's great!

One problem though, I can't seem to figure out how to add channels, I have all the files in the right place, but it doesn't seem to matter if the files are there or not. All the channels that are available are the main channel and the user private channel.


Also, is it possible to add moderator/admin powers to a certain group? Thanks!
I am not sure how to add channels via the interface, though I know a couple of people who have it working, but you can add another usergroup to the moderators by editing the CustomAjaxChat.php.

    function getValidLoginUserData() {
         global $mybb;

         // Check if we have a valid registered user:

         if($mybb->user['uid']) {
             $userData = array();
             $userData['userID'] = $mybb->user['uid'];

             $userData['userName'] = $this->trimUserName($mybb->user['username']);
             
             // Take the userrole from the MyBB users primary group:
             if($mybb->user['usergroup'] == 4)
                 $userData['userRole'] = AJAX_CHAT_ADMIN;
             else if($mybb->user['usergroup'] == 3)
                 $userData['userRole'] = AJAX_CHAT_MODERATOR;
             else
                 $userData['userRole'] = AJAX_CHAT_USER;

             return $userData;
         } else {
             // Guest users:
             return $this->getGuestUser();
         }
     }
    

Just copy and paste the lines as below

             else if($mybb->user['usergroup'] == 2)
                 $userData['userRole'] = AJAX_CHAT_MODERATOR;

so you have this extra line in your AJAX chat

 else if($mybb->user['usergroup'] == 3)
                 $userData['userRole'] = AJAX_CHAT_MODERATOR;
 else if($mybb->user['usergroup'] == 2)
                 $userData['userRole'] = AJAX_CHAT_MODERATOR;

That will make all of the users in group2 moderators. Adjust the group id to fit your needs.
Thanks for your help.

However, I get this error when I paste that code below the bracket



Parse error: syntax error, unexpected T_ELSE, expecting T_FUNCTION in /home/xxx/public_html/forums/chat/lib/class/CustomAJAXChat.php on line 97
Ah - formatting issue in post - two code blocks combined. I have fixed that.

I used that EXACT code on my own chat and tested it. It worked.
Okay, I got that working. Thank you!


Now I need to figure out the channels, I understand I need to edit channels.php in the data folder, which I did

This is my code

$channels[0] = 'Main';
$channels[1] = 'Private';
$channels[2] = 'Room1';
$channels[3] = 'Room2';


However it doesn't show up, the only thing i see is Main and Private, the others don't show up
Hmm, I don't have a data folder or a channels.php. That could be why I can't get it to work Big Grin
Unfortunately, after a year of use, it seems I'm going to have to switch to IRC. AJAX Chat worked well on my old server because it was faster. I've switched to a more economic server, but nevertheless it seems AJAX Chat is using an insane amount of resources, certainly more than you'd expect. Time to look for IRC implementing then...

It's been nice knowing you, AJAX Chat plugin. Sad You served me well!
re how to add forums to your AJAX chat channels >.

http://www.leefish.nl/mybb/thread-3241.html
All I get is a blank page. I've ran the sql-installation manually with phpmyadmin, still everything is blank. Install and /chat, nothing.

Any ideas?
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38