XF 1.4 User-specific content - conditional statement

rugk

Active member
I'm trying to make a template where I want to display different values depending on the user group.

So basically this is the part of the template which fails:
HTML:
  <xen:if is="{$visitor.is_admin}">
    <p>admin</p>
  <xen:elseif is="{$visitor.is_moderator}">
    <p>mod</p>
  <xen:elseif is="{$visitor.user_id}">
    <p>registered</p>
  <xen:else />
    <p>visitor</p>
  </xen:if>

XenForo always reports there is an error on line 9, which is the last line here. But I have no idea what's wrong with this line...
 
Okay, I tried it this way:
HTML:
  <xen:if is="{$visitor.is_admin}" />
    <p>admin</p>
  <xen:elseif is="{$visitor.is_moderator}" />
    <p>mod</p>
  <xen:elseif is="{$visitor.user_id}" />
    <p>registered</p>
  <xen:else />
    <p>visitor</p>
  </xen:if>

But XenForo still complains about a syntax error in line 9.
 
Ah yes thanks. Didn't noticed I added one there. Thanks.

This way it works:
HTML:
  <xen:if is="{$visitor.is_admin}">
    <p>admin</p>
  <xen:elseif is="{$visitor.is_moderator}" />
    <p>mod</p>
  <xen:elseif is="{$visitor.user_id}" />
    <p>registered</p>
  <xen:else />
    <p>visitor</p>
  </xen:if>
 
Back
Top Bottom