How can I get user information?
I mean, a user is logged in. How can I display their name and email to them. I know their name can be displayd by using Yii::app()->user->name but that doesn't work for email.
Any tips?
How can I get user information?
I mean, a user is logged in. How can I display their name and email to them. I know their name can be displayd by using Yii::app()->user->name but that doesn't work for email.
Any tips?
Thanks. After following that I get
Property "CWebUser.email" is not defined.
I put this in my UserIdentity
$this->setState('email', $user->email);
and tried to call it using
<?php echo $email=Yii::app()->user->email; ?>
Which version are you using? This is for version 1.0.3. In earlier versions, you need to use Yii::app()->user->getState('email')
Using 1.0.3
My stack trace is
Stack Trace #0 C:wampwwwyiiyiiframeworkwebauthCWebUser.php(88): CComponent->__get('email') #1 C:wampwwwb4deathprotectedviewssiteindex.php(: CWebUser->__get('email') #2 C:wampwwwyiiyiiframeworkwebCBaseController.php(119): require('C:wampwwwb4d...') #3 C:wampwwwyiiyiiframeworkwebCBaseController.php(88): CBaseController->renderInternal('C:wampwwwb4d...', NULL, true) #4 C:wampwwwyiiyiiframeworkwebCController.php(652): CBaseController->renderFile('C:wampwwwb4d...', NULL, true) #5 C:wampwwwyiiyiiframeworkwebCController.php(591): CController->renderPartial('index', NULL, true) #6 C:wampwwwb4deathprotectedcontrollersSiteController.php(28): CController->render('index') #7 C:wampwwwyiiyiiframeworkwebactionsCInlineAction.php(32): SiteController->actionIndex() #8 C:wampwwwyiiyiiframeworkwebCController.php(265): CInlineAction->run() #9 C:wampwwwyiiyiiframeworkwebCController.php(243): CController->runAction(Object(CInlineAction)) #10 C:wampwwwyiiyiiframeworkwebCController.php(225): CController->runActionWithFilters(Object(CInlineAction), Array) #11 C:wampwwwyiiyiiframeworkwebCWebApplication.php(335): CController->run('index') #12 C:wampwwwyiiyiiframeworkwebCWebApplication.php(123): CWebApplication->runController('site/index') #13 C:wampwwwyiiyiiframeworkbaseCApplication.php(170): CWebApplication->processRequest() #14 C:wampwwwb4deathindex.php(11): CApplication->run() #15 {main}
Yii::app()->isGuest is true or not? If true, it won't have email state.
Yep thats the problem. i get the error when as a guest!