I have a master template in:
protected/views/layouts/main.php
and I’m trying to show a “Logout” button if a user is logged in. However, from the template code (main.php)
Yii::app()->user->isGuest
is returning true even if the user is logged in.
Having said that, in my module’s view (protected/modules/mymodule/views/query/view.php), the same
Yii::app()->user->isGuest
returns false. Why isn’t the template picking it up and what do I need to do to make it so?
Thanks in advance.
paalgg
(Paalgg)
2
Your code look correct. Try using the function instead:
var_dump(Yii::app()->user->getIsGuest());
That function will return if the current user is guest (not authenticated).
Yii::app()->user is documented here: CWebUser
jkofsky
(Jkofsky)
3
Please show the specific code you are using for generating the Logout button.