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

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 !
 
What is the problem with this code I created:


public function renderTagUrl(array $tag, array $rendererStates)
{
$visitor = XenForo_Visitor::getInstance();

if ($visitor['user_id'] == 0 && $visitor['user_state'] != 'valid')
{
return new XenForo_Phrase('custom_phrase_display');
}

return parent::renderTagUrl($tag, $rendererStates);
}

Not working for users "Awaiting email activation"
 
What is the problem with this code I created:




Not working for users "Awaiting email activation"
$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']
 
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 :)
 
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 :)
yes, should work:)
 
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....
 
Can you explain, why this code not working: if ($visitor['user_id'] == 0 && $visitor['user_state'] != 'valid')
because if user_id == 0 then user_state = valid

check to code from XenForo_Model_User::getVisitingGuestUser

 
Top Bottom