Hello guys
I want to logout user everywhere in my site when my condition satisfy. The best way, is to put my code in base controller class which will execute first of all I think. My code is:
if(!Yii::app()->user->isGuest)
{
$user = User::model()->findByAttributes(array(), 'id=:id AND username=:username', array(
':id' => Yii::app()->user->id,
':username' => Yii::app()->user->username,
));
if($user === NULL)
{
$this->redirect(Yii::app()->createUrl('site/logout'));
}
}
But when it want to excute $this->redirect it can’t connect to logout action, what I can do?
Any help will be appreciated, thanx in advance