SMF Custom Member Groups

22 views
Skip to first unread message

Azhtek Je-Nckos

unread,
Jun 19, 2016, 6:41:27 AM6/19/16
to AJAX-chat
Hi there,

I run a forum which is operating on SMF 2.0.11 and using Frug's AJAX, version 0.8.8, as a dedicated chat. I've been searching around for a few hours now, but haven't been able to find anything up-to-date or definitive. 

I want to add in custom usergroups to the chat, as suggested in this old wiki post which is only for phpBB, but have been unable to turn out much of anything. I'm hoping that some users here have had better luck with it and could offer some advice. 

The biggest one seems to be the instruction for customAJAXChat.php, which tries to have you modify the section that checks the logged in user's credentials. Unfortunately, that section of my file looks nothing like that. I've got this

 // Check if we have a valid registered user:
 
if(!$context['user']['is_guest']) {
 $userData
= array();
 $userData
['userID'] = $context['user']['id'];
 
 $userData
['userName'] = $this->trimUserName($context['user']['name']);
 
 
if($context['user']['is_admin'])
 $userData
['userRole'] = AJAX_CHAT_ADMIN;
 
// $context['user']['is_mod'] is always false if no board is loaded.
 
// As a workaround we check the permission 'calendar_post'.
 
// This is only set to true for global moderators by default:
 elseif
(in_array(2, $user_info['groups']))
 $userData
['userRole'] = AJAX_CHAT_MODERATOR;
 
else
 $userData
['userRole'] = AJAX_CHAT_USER;


if($this->getConfig('customModeratorList') && in_array($userData['userID'], $this->getConfig('customModeratorList'))) {
   $userData
['userRole'] = AJAX_CHAT_MODERATOR;
}


 
return $userData;
 
 
} else {

I've tried adding an elseif above the AJAX_CHAT_USER entry, which looked like this,

 elseif(in_array(2, $user_info['groups']))
 $userData
['userRole'] = AJAX_CHAT_MODERATOR;
 elseif
($userData['groupID'] == 11)
                    $userData
['userRole'] = AJAX_CHAT_PINK;
 
else
 $userData
['userRole'] = AJAX_CHAT_USER;
 
And at the risk of sounding like an idiot, I'm not entirely sure I know what I'm doing here. 

Anyone able to offer some advice or share their successful attempt at this modification? Cheers in advance.
Reply all
Reply to author
Forward
0 new messages