thyseus / yii-user-management

a user management module collection for the yii framework
185 stars 122 forks source link

CWebUser and its behaviors do not have a method or closure named "data". #2

Closed christiansalazar closed 12 years ago

christiansalazar commented 12 years ago

Hi !

Don't worry, is not an error at all. Instead is a: how to avoid this exception, when installing your module.

first, this exception occurs when you try to install YUM, running action: index.php?r=user/install, the exception occurs when a user is currently logged on.

how to avoid this exception ? first, prior to install user module, first logoff your currently logged on user.

cause:

when you invoke "index.php?r=user/install", the beforeAction method in YumController.php detects a logged on user, so, it tries to get a "data()" method from it, oviously, if your module is not installed then an exception occurs because data() is null or inexisting.

// YumController.php // abstract class YumController extends CController { // ... public function beforeAction($action) { if(Yum::module()->enableOnlineStatus && !Yii::app()->user->isGuest) Yii::app()->user->data()->setLastAction();

    return parent::beforeAction($action);
}
// ...

}

christiansalazar commented 12 years ago

** Please provide this extra line in your user/docs/install.txt, after installing your testdrive yii aplication:

"please be ensured to LOGOUT any session started on your testdrive or current application. if you try to install user module and a previous session was started (any active login) then an exception will occur (exception: blabla)".

thyseus commented 12 years ago

Another idea to solve this problem: swap step 5 and step 7 in the install tutorial, so the YumWebUser component is configured before the installer is run. This makes things also more logical, because the user does not need to switch between the editor and his browser. Also, a small note in the Common Problems section is added.

Already done this, it will go into my next commit. Thanks for reporting.