Conditional statement to hide something only from certain user groups

PumpinIron

Well-known member
With my Google Ads, I want to display the ads to all user groups except two (supporting members and lifetime supporting members).

Right now I am using this code:

Code:
        <!-- Added by Chris (conditional code that only shows Google ads if user is not logged in)-->
        <xf:if is="!$xf.visitor.user_id">
            <link rel="preload" href="https://prebid.dblks.net/ff/2715236.js" as="script">
            <link rel="preload" href="https://securepubads.g.doubleclick.net/tag/js/gpt.js" as="script">
            <script async src='https://securepubads.g.doubleclick.net/tag/js/gpt.js'></script>
            <script async src="https://prebid.dblks.net/ff/2715236.js"></script>
        </xf:if>

That code works great in only showing the ads to visitors.

Like I said though, I want to change it so that the ads show to every user group except my supporting members and lifetime members.

What would be the condition code I'd need in order to do this?
 
With my Google Ads, I want to display the ads to all user groups except two (supporting members and lifetime supporting members).

Right now I am using this code:

Code:
        <!-- Added by Chris (conditional code that only shows Google ads if user is not logged in)-->
        <xf:if is="!$xf.visitor.user_id">
            <link rel="preload" href="https://prebid.dblks.net/ff/2715236.js" as="script">
            <link rel="preload" href="https://securepubads.g.doubleclick.net/tag/js/gpt.js" as="script">
            <script async src='https://securepubads.g.doubleclick.net/tag/js/gpt.js'></script>
            <script async src="https://prebid.dblks.net/ff/2715236.js"></script>
        </xf:if>

That code works great in only showing the ads to visitors.

Like I said though, I want to change it so that the ads show to every user group except my supporting members and lifetime members.

What would be the condition code I'd need in order to do this?
You can use something like this:

Code:
<xf:if is="{{$xf.visitor.isMemberOf([1, 2, 10, 14, 32])}} && {{!$xf.visitor.isMemberOf([5, 3, 30, 19, 4, 6, 15, 29, 17, 8, 9, 27, 28, 11, 18, 31, 33])}}">
   place code here
    </xf:if>
Change the user group numbers you see to fit the groups you want.
 
Last edited:
This is an excellent ads manager that allows you to build all manner of conditional criteria, including user group membership (in case you are interested):

 
You can use something like this:

Code:
<xf:if is="{{$xf.visitor.isMemberOf([1, 2, 10, 14, 32])}} && {{!$xf.visitor.isMemberOf([5, 3, 30, 19, 4, 6, 15, 29, 17, 8, 9, 27, 28, 11, 18, 31, 33])}}">
   place code here
    </xf:if>
Change the user group numbers you see to fit the groups you want.
Thanks, this did the trick!
 
Back
Top Bottom