1. 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

Discussion in 'XenForo Development Discussions' started by Neil, Sep 18, 2011.

  1. Neil

    Neil Member

    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?
  2. Brogan

    Brogan 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}">
  3. Neil

    Neil Member

    Doh...should have tried that! Thanks - works perfectly!

Share This Page