• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Display template content if user is not a member of specific groups

#1
I'm looking for some advice with this one. I've got a block on HTML in a template that I don't want to appear if the user viewing the page is a member (primary or secondary) of any 1 of 3 groups. For one group, this If statement works fine:

Code:
<xen:if is="!{xen:helper ismemberof, $visitor, 3}">
But if I extend this to check for each of the three groups it doesn't work:

Code:
<xen:if is="!{xen:helper ismemberof, $visitor, 3} OR !{xen:helper ismemberof, $visitor, 1} OR !{xen:helper ismemberof, $visitor, 7}">
I guess using multiple If / Elseif statements would work but I wanting to go for something more "efficient" than that. Any ideas anyone?
 

Brogan

XenForo moderator
Staff member
#2
Use AND instead of OR.

Code:
 <xen:if is="!{xen:helper ismemberof, $visitor, 3} AND !{xen:helper ismemberof, $visitor, 1} AND !{xen:helper ismemberof, $visitor, 7}">