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

#1
If ($visitor['user_id'] == 0) < Guest
What should be use for user's who haven't yet activated their account "Awaiting Email activation"?
Thanks !
 
#6
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"
 
R

ragtek

Guest
#7
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']
 
#8
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 :)
 
R

ragtek

Guest
#12
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....
 
Top