anyone knows how to login a user then redirected to the previous page when he logout.
anyone knows how to login a user then redirected to the previous page when he logout.
Quote
see returnUrl
could put a sample code to implement that?
Here's the action automatically generated by yii that uses this functionality:
public function actionLogin()
{
$user=new LoginForm;
// collect user input data
if(isset($_POST['LoginForm']))
{
$user->attributes=$_POST['LoginForm'];
// validate user input and redirect to previous page if valid
if($user->validate())
$this->redirect(Yii::app()->user->returnUrl);
}
// display the login form
$this->render('login',array('user'=>$user));
}