Uutiset:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu
Advertisement:

How to remove content for certain groups only.

Aloittaja casper_shadowrider, helmikuu 25, 2005, 05:16:50 IP

« edellinen - seuraava »

casper_shadowrider

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.
Make god laugh, tell him your plans

Oldiesmann

Michael Eshom
Christian Metal Fans

casper_shadowrider

#2
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')
Make god laugh, tell him your plans

[Unknown]

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]

Advertisement: