XF 2.2 Syntax error in if statement... can't work it out.

BIG LLC

Active member
Checking for existence of a custom profile field, and that the field is not a certain value:

<xf:if is="$xf.visitor.Profile.custom_fields.afl_club" && !is="$xf.visitor.Profile.custom_fields.afl_club == 'tasmania'">

Saving the template I get a syntax error message but no detail on what the problem is.

Deleting all but this if /if gives the same error so it's not other code in the template.

Have used IF statements many times in the past, and this custom profile field is referenced in the existing, working version of this template, for instance:

<xf:if is="$xf.visitor.Profile.custom_fields.afl_club == 'adelaide'">
 
Hold up.

<xf:if is="{$xf.visitor.Profile.custom_fields.afl_club} AND {$xf.visitor.Profile.custom_fields.afl_club} != 'tasmania'">
 
Code:
<xf:if is="$xf.visitor.user_id && ($xf.visitor.Profile.custom_fields.afl_club is not empty) && ($xf.visitor.Profile.custom_fields.afl_club != 'tasmania'")>
    <xf:comment>If visitor is registered user, has some value set in 'afl_club' field and that value is not 'tasmania'</xf:comment>
</xf:if>
 
Last edited:
Top Bottom