MyBB Community Forums

Full Version: Moderator Ajax chat
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
My question:

In an ideal world a moderator has to log into a moderator option and then they become a moderator on the chat.
However, my moderators have 2 accounts now (1 normal account and 1 moderator account) because they take turns on moderating on the chat. I've noticed that on flashbased chats there is an option to, first log in seperatly for moderator, become a moderator on the chat. And when somebody else logs in after you as a moderator and you refresh, then you are just a chatter without moderator rights on the chat again. Could this be possible on MyBB with Ajax chat?

I hope somebody already had to deal with this problem and maybe has an answer.

(Sorry if my english isn't that great, i'm dutch)

Thank you in advanced

Nathalie
Which ajax chat plugin are you using?
We are using Blueimp Ajax Chat.
Ok, I am also using that chat. You can add groups to be moderators - ie the moderator group that is just for a section. That should put them in usergroup 6 I think.

Try this in your CustomAJAXChat.php

http://yoursite/pathtoforum/chat/lib/cla...AXChat.php round about line 73

Adjust usergroups to fit your needs.

// 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 if($mybb->user['usergroup'] == 6)
                 $userData['userRole'] = AJAX_CHAT_MODERATOR;
             else
                 $userData['userRole'] = AJAX_CHAT_USER;

This may not be exactly what you wanted, I don't know.
That was the original first question that i had, we figured that one out yesterday (therefore i removed that question) and i will specify what i mean now.

We figured out that when you go to your profile, you can change the Group you are in if you have more then one group assigned to you. So if a moderator wants to be a moderator or just a chatter on the chat, in theory they could change the Group Setting in the profile.
However Ajax Chat only looks at the Primary User Group and we want Ajax to look at the Display User Group. And the Primary Group doesn't change if you change your group in your profile.
So we searched where Ajax has the code where it says he has to take the Primary User Group but we didn't find it.
Maybe you know where that is?
Ok, thanks for clearing that up - I thought I was going mad Big Grin

I went away and researched the answer then when I came back and posted it the question had changed.

in theory - you can adjust the above query. As display group is secondary to usergroup you would have to query display group first. So:

// Take the userrole from the MyBB users primary group:
              if($mybb->user['displaygroup'] == 6)
                  $userData['userRole'] = AJAX_CHAT_MODERATOR;
              else 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;
Not tested.
Sorry for the confusion, my fault Blush

We've tried the code and it worked.
Thank you so much. Smile