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

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:

<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:

<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?


XenForo moderator
Staff member
Use AND instead of OR.

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