Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

Show message to a few group's only

Aloittaja Xarkurai, heinäkuu 16, 2013, 07:31:08 IP

« edellinen - seuraava »

Xarkurai

Hello everyone.

I got a fast question which I can't seem to figure out how to make it work (sadly enough my brains are not smart enough).
I would love to have this code work for multiple groups.
What would be the best way to make it work?
At first I wanted to do it seperated like || but that would be a bit.. Clumsy I guess.

Based on this code:

if  (!in_array(4, $user_info['groups']))
{
Echo' you are not able to enter this section! ';
}


-Xarwin
Useful paid mod: Badge Awards - Award members for actions

4Kstore

you can use a new array and put in there all the groups that you want... then instead 4 you can put the new array...

¡¡NEW MOD: Sparkles User Names!!!

Mick.

Try this:
                                                                        $var = array_intersect($GLOBALS['user_info']['groups'], array(1,13,15));
                                                                        if (count($var) != 0)
                                                                        {
                                                                        echo '
                                you are not able to enter this section!';
                                                                        }



Replace the membergroups id's  ex. 1,13,15 with those you want want to se this message.

Mick.

Lainaus käyttäjältä: Mick. - heinäkuu 16, 2013, 08:06:20 IP
Try this:
                                                                        $var = array_intersect($GLOBALS['user_info']['groups'], array(1,13,15));
                                                                        if (count($var) != 0)
                                                                        {
                                                                        echo '
                                you are not able to enter this section!';
                                                                        }



Replace the membergroups id's  ex. 1,13,15 with those you want want to se this message.

I use non smf custom menu buttons. I use this for groups that are allowed to see diff menu buttons, messages, etc.

Xarkurai

Thanks for the response 4Kstore, while I was writing a respond, Mick. already answered.

So, also thanks for your response Mick. .
It is working exactly as I wanted, much appreciated :).
Useful paid mod: Badge Awards - Award members for actions

Advertisement: