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

Need help with IF condition.

Discussion in 'XenForo Questions and Support' started by arcaneex, Oct 24, 2012.

  1. arcaneex

    arcaneex Active Member

    I have this:
    <xen:if is="{$user.steam_auth_id} > 0">
    I need it, to check on login of the user with this condition. How?
    TL;DR How to make a conditional after someone logins, if the condition is true it logs him in as usual, otherwise it doesn't show him the forum but rather a popup or a page ( and he cannot view the forum, at all untill the conditional is set to true )
  2. Chris D

    Chris D XenForo Developer Staff Member

    Whenever you're talking about the currently logged in user, you would use $visitor rather than $user.

    Also, if you're trying to check if the value exists or NOT 0 then it's sufficient to simply do this:

    <xen:if is="{$visitor.steam_auth_id}">
    Jake Bunce likes this.
  3. arcaneex

    arcaneex Active Member

    I'm sorry I guess I wasn't clear nuff.
    I want to execute an if condition AFTER the login, and unless the condition is true the user won't be able to view the forum list
  4. James

    James Well-Known Member

    <xen:if is="{$visitor.user_id} AND !{$visitor.steam_auth_id}">
    // user is logged in and doesn't have a steam auth ID
    Jake Bunce and arcaneex like this.
  5. arcaneex

    arcaneex Active Member

    Where do I put this to make him unable to view the forums unless he has steam auth ID?
  6. James

    James Well-Known Member

    If you don't want him to view anything, you'll probably need to put it in the PAGE_CONTAINER template.
    Jake Bunce and arcaneex like this.
  7. arcaneex

    arcaneex Active Member

    I want it to redirect him to a page everytime he tries to go on the forum list.
    Last time I ask for help please and thanks :D
  8. James

    James Well-Known Member

    Then you have 2 options:
    Using a HTML redirect:
    <meta http-equiv="Refresh" 
     content="1; URL=MY-URL">
    Editing XenForo_ControllerPublic_Index (I think).
    Jake Bunce likes this.
  9. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Permissions via template conditions is not ideal. Ideally your steam addon would put users into a different usergroup so you can set permissions using groups.
    James likes this.

Share This Page