Mohannad - 2012-04-14

So finally i've managed to make 2 custom groups in a custom colors but unfortunately i wasn't able to add more than 2 groups because when i did add a third group whoever was on that group was not able to join the chat. But i'm pretty sure together we will figure what am i missing. So ill show you what i did:

OPEN
chat/lib/config.php

FIND

// Define AJAX Chat user roles:

ADD AFTER
Tip: Add this line on a new blank line after the preceding line to find.

if(!defined('AJAX_CHAT_VIP')) define('AJAX_CHAT_VIP', 5);
if(!defined('AJAX_CHAT_VIP')) define('AJAX_CHAT_NEW', 6);

OPEN
chat/lib/class/CustomAJAXChat.php

FIND

            if($auth->acl_get('a_'))
                $userData['userRole'] = AJAX_CHAT_ADMIN;
            elseif($auth->acl_get('m_'))
                $userData['userRole'] = AJAX_CHAT_MODERATOR;
            else
                $userData['userRole'] = AJAX_CHAT_USER;

REPLACE WITH
Tip: Replace the preceding lines to find with the following lines.

            $userData['groupID'] = $user->data['group_id'];
            if($auth->acl_get('a_')) {
                $userData['userRole'] = AJAX_CHAT_ADMIN;
            } elseif($auth->acl_get('m_')) {
                $userData['userRole'] = AJAX_CHAT_MODERATOR;
            }    else {
                // Check if we have a member of our custom user group
                if($userData['groupID'] == 7)
                    $userData['userRole'] = AJAX_CHAT_VIP;
                elseif($userData['groupID'] == 8)
                    $userData['userRole'] = AJAX_CHAT_NEW;
                else
                    $userData['userRole'] = AJAX_CHAT_USER;
            }

Note: You may have to replace the groupID 7 and 8 with the id number of your custom user groups.
* Note: The trick was here, when i added the second group, i changed "if" to "elseif".

OPEN
chat/lib/class/AJAXChat.php

FIND

                    ($this->getUserRole() == AJAX_CHAT_MODERATOR || $this->getUserRole() == AJAX_CHAT_USER))

REPLACE WITH
Tip: Replace the preceding line to find with the following line.

                    ($this->getUserRole() == AJAX_CHAT_MODERATOR || $this->getUserRole() == AJAX_CHAT_VIP || $this->getUserRole() == AJAX_CHAT_NEW || $this->getUserRole() == AJAX_CHAT_USER))

FIND

            if($userData['userRole'] == AJAX_CHAT_USER || $userData['userRole'] == AJAX_CHAT_MODERATOR || $userData['userRole'] == AJAX_CHAT_ADMIN) {

REPLACE WITH
Tip: Replace the preceding line to find with the following line.

            if($userData['userRole'] == AJAX_CHAT_USER || $this->getUserRole() == AJAX_CHAT_VIP || $this->getUserRole() == AJAX_CHAT_NEW || $userData['userRole'] == AJAX_CHAT_MODERATOR || $userData['userRole'] == AJAX_CHAT_ADMIN) {

FIND

            } else if($this->getUserRole() == AJAX_CHAT_USER && $this->getConfig('allowUserMessageDelete')) {

REPLACE WITH
Tip: Replace the preceding line to find with the following line.

            } else if(($this->getUserRole() == AJAX_CHAT_USER || $this->getUserRole() == AJAX_CHAT_VIP || $this->getUserRole() == AJAX_CHAT_NEW) && $this->getConfig('allowUserMessageDelete')) {

OPEN
chat/js/chat.js

FIND

            if(this.userRole == 1 || this.userRole == 2 || this.userRole == 3) {

REPLACE WITH
Tip: Replace the preceding line to find with the following line.

            if(this.userRole == 1 || this.userRole == 2 || this.userRole == 3 || this.userRole == 5  || this.userRole == 6) {

FIND

        if((((this.userRole == 1 && this.allowUserMessageDelete && (userID == this.userID ||

REPLACE WITH
Tip: Replace the preceding line to find with the following line.

        if(((((this.userRole == 1 || this.userRole == 5 || this.userRole == 6) && this.allowUserMessageDelete && (userID == this.userID ||

FIND

                return 'chatBot';

ADD AFTER
Tip: Add these lines on a new blank line after the preceding line to find.

            case 5:
                return 'vip';
            case 5:
                return 'new';

OPEN
chat/css/font.css

FIND

#content #chatList span.moderator {

ADD BEFORE
Tip: Add these lines on a new blank line before the preceding line to find.

#content #chatList span.vip {
    font-weight:bold;
}
#content #chatList span.new {
    font-weight:bold;
}

OPEN
chat/css/.css

FIND

    #content .moderator {

ADD BEFORE
Tip: Add these lines on a new blank line before the preceding line to find.

    #content .vip {
        color: #660099;
    }
    #content .new {
        color: #00FFFF;
    }

Note: Do this change on all related .css files (incl. print.css). Specify the color you want to use.

OPEN
chat/css/shoutbox.css

FIND

#ajaxChatContent #ajaxChatList span.moderator {

ADD BEFORE
Tip: Add these lines on a new blank line before the preceding line to find.

#ajaxChatContent #ajaxChatList span.vip {
    font-size: 0.9em;
    font-weight: bold;
}
#ajaxChatContent #ajaxChatList span.new {
    font-size: 0.9em;
    font-weight: bold;
}

FIND

#ajaxChatContent .moderator {

ADD BEFORE
Tip: Add these lines on a new blank line before the preceding line to find.

#ajaxChatContent .vip {
    color: #660099;
}
#ajaxChatContent .new {
    color: #00FFFF;
}

As i said, when i tried to add a third group, users on that group were not able to join the chat.