Login Button Instead Logout In Menu

I have a problem in chapter 7 code, when changing UserIdentity class code, particularly when i define private $_id and public function getId as is shown in page 165. I don’t know if the application is still doing the login properly, but the button for login is shown in menu instead logout(demo) or logout(admin). Thanks in advance to the person which helps me to understand this behavior. I leave the code for UserIdentity.php (i don’t know if is going to be enough).




class UserIdentity extends CUserIdentity

{


        private $_id;


        /**

         * Authenticates a user.

         * The example implementation makes sure if the username and password

         * are both 'demo'.

         * In practical applications, this should be changed to authenticate

         * against some persistent user identity storage (e.g. database).

         * @return boolean whether authentication succeeds.

         */

        public function authenticate()

        {

                $users=array(

                        // username => password

                        'demo'=>'demo',

                        'admin'=>'admin',

                );

                if(!isset($users[$this->username]))

                        $this->errorCode=self::ERROR_USERNAME_INVALID;

                else if($users[$this->username]!==$this->password)

                        $this->errorCode=self::ERROR_PASSWORD_INVALID;

                else

                        $this->errorCode=self::ERROR_NONE;

                return !$this->errorCode;

        }

  


        public function getId()

        {

                return $this->_id;

        }

}                                                                                                                  




I know that i’m not using the function getID or _id, but to me it seems that Logout button have to work the same way, but it doesn’t.

you have to modify authenticate function based on this part of the book, take a look at that page again