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

XF 1.2 Hide ad from one specific user group

Mr Lucky

Well-known member
#1
I'm sure this must be easy. here is my code:

Code:
<xen:if is="{$post.position} == 0 AND !{$message.conversation_id}">
<div style="width:100%;height:10px;margin-top:40px;background:#ffffff">AD HERE</div>
</xen:if>
How do I make it so that does not display to one specified usergroup?

Thanks
 

Mr Lucky

Well-known member
#3

Many thanks. I have read that but am not quite sure how I use it.

Say I want the above to only display to one group, according to that page I use

Code:
<xen:if is="{xen:helper ismemberof, $visitor, x}">
So to show the above only to unregistered I have:

Code:
<xen:if is="{$post.position} == 0 AND !{$message.conversation_id}" AND is="{xen:helper ismemberof, $visitor, 1}" >
<div style="width:100%;height:10px;margin-top:40px;background:#ffffff"></div>
</xen:if>
However I get this error:

The following templates contained errors and were not saved: ad_message_below: 1) Line 2: Template syntax error.
 

Sheratan

Well-known member
#4
How about:

Code:
<xen:if is="{$post.position} == 0 AND !{$message.conversation_id}">
<xen:if is="{xen:helper ismemberof, $visitor, 1}" >
<div style="width:100%;height:10px;margin-top:40px;background:#ffffff"></div>
</xen:if></xen:if>
 

Brogan

XenForo moderator
Staff member
#7
Oops. Made a typo which completely changed the meaning of my previous post.

I meant to post you can't use is=" inside the if statement, as you have done here:
Code:
<xen:if is="{$post.position} == 0 AND !{$message.conversation_id}" AND is="{xen:helper ismemberof, $visitor, 1}" >
It should simply be:
Code:
<xen:if is="{$post.position} == 0 AND !{$message.conversation_id} AND {xen:helper ismemberof, $visitor, 1}" >
 

Mr Lucky

Well-known member
#9
OK so far, many thanks for the help, but what I f I want to show to two usergroups

Neither of these work, they show to all groups.

Code:
<xen:if is="{xen:helper ismemberof, $visitor, 1, 2} ">
Code:
<xen:if is="{xen:helper ismemberof, $visitor, 1} OR {xen:helper ismemberof, $visitor, 2} ">