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

XF 1.1 Could someone help me with my conditionals please?

Discussion in 'XenForo Questions and Support' started by petertdavis, May 7, 2012.

  1. petertdavis

    petertdavis Well-Known Member

    I'm trying to figure out how to do this and not getting it exactly right. I'm using the ad_above_top_breadcrumb template to show one set of ads to any visitor who isn't logged in, another set of ads to certain usergroups, and no ads to the rest. Here's what I have right now...

    <xen:if is="{$visitor}">
    <--------Ad Code----->
    <xen:if is="!{xen:helper ismemberof, $visitor, 42, 4, 5, 32, 43, 3}">
    <--------Ad Code----->
  2. DBA

    DBA Well-Known Member

    Instead of using the is="{$visitor}", try using usergroups for both.

    <xen:if is="{xen:helper ismemberof, $visitor, 1}">
    This content will show to non logged in users (visitors)
    <xen:if is="{xen:helper ismemberof, $visitor, 42, 4, 5, 32, 43, 3}">
    This content will show to members of user groups x or y
    petertdavis likes this.
  3. Kevin

    Kevin Well-Known Member

    You could also look for the User ID to identify the guests...
    <xen:if is="{xen:helper ismemberof, $visitor, 42, 4, 5, 32, 43, 3}">
         <!-- Content for users in groups 42, 4, 5, 32, 43, & 3 -->
    <xen:elseif is="!{$visitor.user_id}" />
         <!-- Content for users who are not logged in -->
    DBA and petertdavis like this.
  4. bashy

    bashy Member

    Thanks, helped me code no ads for premium user group.

Share This Page