/** * Actions to be taken after logging in. * Overloads the parent method in order to mark superusers. * @param boolean $fromCookie whether the login is based on cookie. */ public function afterLogin($fromCookie) { parent::afterLogin($fromCookie); $command = Yii::app()->db->createCommand(); $command->select('username,user_url,display_name,email,fbuid,status,recent_login,avatar')->from('{{user}} u')->where('user_id=' . (int) $this->getId())->limit(1); $user = $command->queryRow(); //Add only some neccessary field if ($user) { // Set User States here $this->setState('current_user', $user); // Set User Roles here $this->setState('current_roles', User::getArrayRoles($this->getId())); if (Rights::getAuthorizer()->isSuperuser($this->getId()) === true) { $this->isSuperuser = true; } } else { throw new CHttpException(503, t('cms', 'Error while Logging into your account. Please try again later.')); } }