REALY NEED HELP for a line of code

Started by bjp, August 21, 2005, 02:05:30 PM

Previous topic - Next topic

bjp

I just want not to allow 2 régulars group poster (4 and 5) and the guests to see a chat button. I try many things like this, but i failed.

if (!in_array($context['member']['ID_GROUP'], array(4,5))) or !$context['user']['is_guest'])

   echo '<a href="../smf11/chat/flashchat.php" target="_blank">',
     ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url']
     . '/chat_icon.gif" alt="FlashChat" style="margin: 2px 0;"
     border="0" />' : "FlashChat"),'</a>';

[Unknown]

if (!in_array(4, $GLOBALS['user_info']['groups']) and !in_array(5, $GLOBALS['user_info']['groups']) and !$context['user']['is_guest'])

-[Unknown]

bjp

#2
Thank you, but it's not working. Admin can't see the chat button and modérator ou supermodérator can't see it too.

The only thing whitch is working good is that guest can't see it. Sorry !

It's not possible to have this king of "condition" ?[context] => Array

            [messages] => 100 Total Messages

Elissen

Is it possible that your admin and/or global moderators also happen to be a member of group 4 or 5? Because that is a post(count) group.

Rudolf

#4
Try this:

if (!( (in_array(4, $GLOBALS['user_info']['groups'])
        or in_array(5, $GLOBALS['user_info']['groups'])
        or $context['user']['is_guest'])
               and
        (!in_array(1, $GLOBALS['user_info']['groups'])
         or !in_array(2, $GLOBALS['user_info']['groups'])
         or !in_array(3, $GLOBALS['user_info']['groups'])
      )
   )
   {...show button...
   }


It should work, but you'll have to test it yourself.
That's a little too complicated.
If you want based on the number of posts you could do:


if ( $user_info['posts']>1000 or in_array(1, $GLOBALS['user_info']['groups']) or in_array(2, $GLOBALS['user_info']['groups']) or in_array(3, $GLOBALS['user_info']['groups']) )
   {...show button...
   }


Logically they should do the same thing, if you set the number in second according to your post groups.

Rudolf
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

bjp


bjp

I try this but members even with the goog number of posts can't see the buton

if ( $user_info['posts']>10 or in_array(1, $GLOBALS['user_info']['groups']) or in_array(2, $GLOBALS['user_info']['groups']) or in_array(3, $GLOBALS['user_info']['groups']) )
   {
echo '<a href="http://www.mysite.com/smf/chat/chat.php" target="_blank">',
     ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url']
     . '/chat_icon.gif" alt="FlashChat" style="margin: 2px 0;"
     border="0" />' : "FlashChat"),'</a>';


   }

[Unknown]

Instead of:

$user_info['posts']

Use:

$GLOBALS['user_info']['posts']

-[Unknown]

bjp


Advertisement: