Home Page Display As Guest After Succesful Login/logout Till Refresh

Hello Guys,

I have a quick question.

I noticed that after logging in to my yii application I get correctly redirected to my home page, but its appereance is the same of what guest users see before logging in (ie. the "login" link at top right is there). However if I refresh the page by pressing f5 everything is displayed correctly. When I click logout, its not getting logged out till I refresh the page.

In other pages other than the homepage, it is logged in. Only in the homepage it shows as guest user.

Has this happened to anyone before?

Thanks in advance !

This works correctly for me.

In SiteController:


     * Displays the login page


    public function actionLogin() {

        $model = new LoginForm;

        // if it is ajax validation request

        if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {

            echo CActiveForm::validate($model);



        // collect user input data

        if (isset($_POST['LoginForm'])) {

            $model->attributes = $_POST['LoginForm'];

            // validate user input and redirect to the previous page if valid

            if ($model->validate() && $model->login())



        // display the login form

        $this->render('login', array('model' => $model));



     * Logs out the current user and redirect to homepage.


    public function actionLogout() {




I would specifically look at the $this->redirect() lines. Other then that check if the menu->items login/logout lines have a ‘visible’ attribute with isGuest/!isGuest

could you post your logout and login action?

I did 8)