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

Visitor Variable Returns User State "Valid" For Unregistered Users?

Discussion in 'XenForo Questions and Support' started by James, Apr 21, 2011.

  1. James

    James Well-Known Member

    When I dump the $visitor variable and view the site logged out, the user state is returned as valid. I was trying to stop guests and unactivated users from viewing things, with something like:
    <xen:if is="!{$visitor.user_id} AND {$user.user_state} == 'valid'">
    And I realised that the $user variable isn't available in the area I want it (returns null when I dump it).

    Which brings me to this: Why is the user state for non-logged in users set to valid? Can't it be set to guest or something, or perhaps no user state at all?
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That does seem strange for {$visitor.user_state} to be valid for guests. But this doesn't stop you from accomplishing your goal.

    Use this condition:

    <xen:if is="{$visitor.user_id} AND {$visitor.user_state} == 'valid'">
    James likes this.
  3. James

    James Well-Known Member

    D'oh... how much of an idiot am I.

    Thanks Jake, I guess it was late :confused:

Share This Page