mishamx / yii-user

Yii PHP Framework extension for registration and management users accounts.
http://yii-user.2mx.org/
186 stars 154 forks source link

Trying to get property of non-object. #25

Open krzysztof-gzocha opened 11 years ago

krzysztof-gzocha commented 11 years ago

Hi. I've just installed yii-eauth extension and the authentication process works pretty well, but after auth I get this error. Any suggestions?

I was thinking about storing service->id as user's ID in my database just after successful login.

I'm using Yii 1.1.12 with yii-user module and this is the errors:

in pop-up window: protected\components\WebUser.php(39):

36 public function updateSession() {
37         $user = Yii::app()->getModule('user')->user($this->id);
38         $userAttributes = CMap::mergeArray(array(
39                                                 'email'=>$user->email,
40                                                 'username'=>$user->username,
41                                                 'create_at'=>$user->create_at,
42                                                 'lastvisit_at'=>$user->lastvisit_at,
43                                            ),$user->profile->getAttributes());
44         foreach ($userAttributes as $attrName=>$attrValue) {
45             $this->setState($attrName,$attrValue);
46         }
47     }

in any other site: protected\modules\user\UserModule.php(197)

public static function isAdmin() {
193         if(Yii::app()->user->isGuest)
194             return false;
195         else {
196             if (!isset(self::$_admin)) {
197                 if(self::user()->superuser)
198                     self::$_admin = true;
199                 else
200                     self::$_admin = false;
201             }
202             return self::$_admin;
203         }
204     }
dekmabot commented 11 years ago

got the same problem. As I see, the new record is not created after authorizing by oauth-provider.

that`s why $user = Yii::app()->getModule('user')->user($this->id); got nothing