Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Aiheen aloitti: casper_shadowrider - helmikuu 25, 2005, 05:16:50 IP

Otsikko: How to remove content for certain groups only.
Kirjoitti: casper_shadowrider - helmikuu 25, 2005, 05:16:50 IP
First, sorry if this has been posted, I have searched, and found nothing exactly that works for me.

I'm trying to have some content (ads) that do not show if you are a member of a certain group. I found some posts that led me to using this code in index.template.php, which is supposed to stop the ads showing if the viewer is in groups 1(admin) or 9;

if ($context['member']['group_id'] !== '1' || $context['member']['group_id'] !== '9')
echo '


But this does not work, although removing the '!' causes no-one to see the ads.

I also tried a version I saw from '[unknown]', on this thread, http://www.simplemachines.org/community/index.php?topic=27101.msg209758#msg209758

if (in_array($context['member']['group_id'], array(1, 9)))

This also did not work.  I'm obviously getting something wrong, can someone point me in the right direction please.
Otsikko: Re: How to remove content for certain groups only.
Kirjoitti: Oldiesmann - helmikuu 25, 2005, 05:54:02 IP
It's $context['member']['ID_GROUP']
Otsikko: Re: How to remove content for certain groups only.
Kirjoitti: casper_shadowrider - helmikuu 25, 2005, 06:12:19 IP
I must be doing something else wrong then, it's still all or nothing, not just the 2 groups I want to exclude.  I tried both(with and without the '!';

if (!in_array($context['member']['ID_GROUP'], array(1, 9)))

and

if ($context['member']['ID_GROUP'] !== '1' || $context['member']['ID_GROUP'] !== '9')
Otsikko: Re: How to remove content for certain groups only.
Kirjoitti: [Unknown] - maaliskuu 22, 2005, 05:21:31 IP
Lainaus käyttäjältä: Oldiesmann - helmikuu 25, 2005, 05:54:02 IP
It's $context['member']['ID_GROUP']

What?  That doesn't even exist.

You most likely want $GLOBALS['user_info']['groups'], which is an array.

-[Unknown]