XF 2.2 ismemberof check in template

Thunderfall

Member
In Xenforo 1.x, to hide ads from certain user group, we did something like this:

<xen:if is="!{xen:helper ismemberof, $visitor, 89}">
<div id="bannerTop" style="min-height: 90px; margin-right: auto; margin-left: auto; padding: 4px 0 4px 0;">
<div id='cdm-zone-04'></div>
</div>
</xen:if>

This check doesn't seem to work under xenforo 2.0.

Also, in 1.x, to check current page is not forum home page in the template, I was doing below but it doesn't seem to work in 2.0.

<xen:if is="{$contentTemplate} != 'forum_list'">

Any idea how to do these checks in 2.0 template?

Thanks.
 

Thunderfall

Member
Thanks Brogan.
How do you negate the value? I tried this but doesn't seem to work?

<xf:if is="!{$xf.visitor.isMemberOf(3)}">

Is there a doc where I could see these syntax?
 

Brogan

XenForo moderator
Staff member
Is there a doc where I could see these syntax?
Not an official one.

To summarise:

Templates & Advertising positions
True
Code:
<xf:if is="$var">

<xf:if is="$var == 'thing'">

<xf:if is="in_array($var, ['thing', 'other_thing'])">

False
Code:
<xf:if is="!$var">

<xf:if is="$var != 'thing'">

<xf:if is="!in_array($var, ['thing', 'other_thing'])">


Navigation entries & widget display conditions
True
Code:
$var

$var == 'thing'

in_array($var, ['thing', 'other_thing'])

False
Code:
!$var

$var != 'thing'

!in_array($var, ['thing', 'other_thing'])
 
Top