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

What is the syntax or variable to use for user's haven't activated their account?

Discussion in 'XenForo Development Discussions' started by thebush, Jan 29, 2012.

  1. thebush

    thebush Member

    If ($visitor['user_id'] == 0) < Guest
    What should be use for user's who haven't yet activated their account "Awaiting Email activation"?
    Thanks !
     
  2. ragtek

    ragtek Guest

    $visitor['user_state'] == 'valid'

    should do it
     
    thebush likes this.
  3. thebush

    thebush Member

    I will try, Feedback later.
     
  4. thebush

    thebush Member

    I think it's email_confirm not valid ?
     
  5. Vincent

    Vincent Well-Known Member

    Just do what ragtek says, you have 99.9% chance it'll work if you're not doing it wrong ;)
     
  6. thebush

    thebush Member

    What is the problem with this code I created:


    Not working for users "Awaiting email activation"
     
  7. ragtek

    ragtek Guest

    $visitor['user_id'] == 0


    this means if user is guest;) but if you check the xf visitor model, you'll see that guests have "user_state" = valid set by default;)
    So you'll condition will always be false!

    you need if ($visitor['user_state'] != 'valid')

    or


    if ($visitor['user_id'] OR ($visitor['user_state'] != 'valid']
     
    thebush likes this.
  8. thebush

    thebush Member

    I'm using this syntax:
    Code:
    if ($visitor['user_id'] == 0 || $visitor['user_state'] != 'valid')
    Is that correct? I tested in localhost, and it hides correctly for the guest and awaiting actiation users :)
     
  9. ragtek

    ragtek Guest

    yes, should work:)
     
    thebush likes this.
  10. thebush

    thebush Member

    Thank you soo much for the guide ragtek!
     
  11. thebush

    thebush Member

    Can you explain, why this code not working: if ($visitor['user_id'] == 0 && $visitor['user_state'] != 'valid')
     
  12. ragtek

    ragtek Guest

    i've forgotten something!


    there are 4 different states: 'valid', 'email_confirm', 'email_confirm_edit', 'moderated'


    so, your condition will be shown to:

    ALL GUESTS
    users with awaiting e-mail confirmation, email_confirm_edit (i'm too lazy to check when this is set) and to moderated users....
     
    thebush likes this.
  13. ragtek

    ragtek Guest

    because if user_id == 0 then user_state = valid

    check to code from XenForo_Model_User::getVisitingGuestUser

     
    thebush likes this.
  14. thebush

    thebush Member

    Among this codes, which is best:

    <= I'm using this one :)
     

Share This Page