XF 2.2 Hiding Ads based on User Group

brian22

Member
Hey all,

We use a different Ad service besides AdSense (which is why we don't use the integrated ad features) and have had a problem hiding a sticky video player for our VIP users. All other ads are hidden save for that lone video ad in the corner.

Per the company, the issue is the ads and video player are showing for certain user groups and it won't work for the sticky video since that player is looking for body classes.

SO basically, how the heck do we hide it? I'm unsure if we can just add a quick code to the EXTRA.css or do I have to add a custom class to the Body.

Thanks!
 
Use a conditional statement.

Single user group:
HTML:
<xf:if is="!$xf.visitor.isMemberOf(x)">
    Ad code
</xf:if>

Multiple user groups:
HTML:
<xf:if is="!$xf.visitor.isMemberOf([x, y])">
    Ad code
</xf:if>

Change x and y to the user group IDs you don't want to see the ad.
 
Back
Top Bottom