Yii Framework Forum: Problem with CWebUser::getState - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Problem with CWebUser::getState Rate Topic: -----

#1 User is offline   kop 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 05-September 10

Posted 05 September 2010 - 09:37 AM

Hi for all. I have some problem then using CWebUser::getState method.

In my CUserIdentity i have:
// if authentification seem's to be ok
$this->_id = $user->user_id;
$this->setState('birth', $user->birth);
$this->errorCode = self::ERROR_NONE;


Then, in the view i'm trying to use getState method:
if(!Yii::app()->user->isGuest)
{
    echo CHtml::encode(Yii::app()->user->birth);
}


And then I get an error: Property "CWebUser.birth" is not defined.
Yii version: 1.1.3

Can anyone help me?
0

#2 User is offline   jefftulsa 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 168
  • Joined: 06-October 08
  • Location:Austin, TX

Posted 06 September 2010 - 11:30 PM

Did you use the CUserIdentity class as input to
Yii::app()->user->login
?

Also, are you attempting to access this information between requests? If so, did you enable cookie-based authentication (by setting
[url="../doc/api/CWebUser#allowAutoLogin"]CWebUser::allowAutoLogin[/url]
to be true)?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users