Simple Machines Community Forum

General Community => Scripting Help => Aiheen aloitti: Carver - syyskuu 21, 2007, 08:52:20 IP

Otsikko: Group Permissions for new button
Kirjoitti: Carver - syyskuu 21, 2007, 08:52:20 IP
I have search for a way to make this work and found a couple of examples neither of which seem to work.
All I am trying to do is only show the Flash Chat Button to the Membergroups who are listed in the array. But, this code works to good and no one can see the button..

Any help would be greatly appreciated. I am using 1.1.3

// FlashChat!

$forum_leaderID = array(1, 2, 5, 6, 7, 8, 9, 11);
if(in_array($user_info['groups'], $forum_leaderID))
    {

echo ($current_action == 'chat' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '

<td valign="top" class="maintab_' , $current_action == 'chat' ? 'active_back' : 'back' , '">

<a href="', $scripturl, '?action=chat"', (!empty($modSettings['fc_newWindow']) ? ' target="_blank"' : ''), '>', $txt['fc_chat'], (!empty($modSettings['fc_showUserCount']) && !empty($context['num_chat']) ? ' [<strong>' . $context['num_chat'] . ' ' . ($context['num_chat'] == 1 ? $txt['user'] : $txt['users']) . '</strong>]' : ''), '</a>

</td>' , $current_action == 'chat' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';}


Thanks
Curt
Otsikko: Re: Group Permissions for new button
Kirjoitti: codenaught - syyskuu 21, 2007, 11:20:45 IP
You need to use array_intersect() when comparing two arrays.

Example:

if(array_intersect($user_info['groups'], $forum_leaderID))
Otsikko: Re: Group Permissions for new button
Kirjoitti: Carver - syyskuu 22, 2007, 07:31:46 IP
Thank You very much !

Curt