[Module] Yii User Management Module

looks like you have introduced a new field registrationType in some table, but unfortunately the data folder is missing in r135 folders.

settingsTable looks to have changed!?

Pl. include the data folder in svn.

../user/install is not working in r135. data folder is needed.

r136

../user/install still doesn’t work.

You get the following error:

Error 500

Property "YumSettings.registrationType" is not defined.

exception ‘CException’ with message 'Property

“YumSettings.registrationType” is not defined.’ in

D:\xampp\htdocs\myWebFolder\blog\framework\base\CComponent.php:131

Stack trace:

#0

D:\xampp\htdocs\myWebFolder\blog\framework\db\ar\CActiveRecord.php(110):

CComponent->__get(‘registrationTyp…’)

#1

D:\xampp\htdocs\myWebFolder\blog\protected\modules\user\UserModule.php(175):

CActiveRecord->__get(‘registrationTyp…’)

#2 D:\xampp\htdocs\myWebFolder\blog\framework\web\CController.php(255):

UserModule->beforeControllerAction(Object(YumInstallController),

Object(CInlineAction))

#3

D:\xampp\htdocs\myWebFolder\blog\framework\web\CWebApplication.php(324):

CController->run(’’)

#4

D:\xampp\htdocs\myWebFolder\blog\framework\web\CWebApplication.php(121):

CWebApplication->runController(‘user/install’)

#5 D:\xampp\htdocs\myWebFolder\blog\framework\base\CApplication.php(135):

CWebApplication->processRequest()

#6 D:\xampp\htdocs\myWebFolder\blog\index.php(11): CApplication->run()

#7 {main} REQUEST_URI=/myWebFolder/blog/index.php/user/install

r134 behaviour for the following url:

http://localhost/myWebFolder/blog/index.php/user/install

contrast it with r135 and r136 in the next post

r135 (and r136) behaviour for the following url:

http://localhost/myW...hp/user/install

please remove the table ‘settings’ in your database, and re-run installer. this error occures because a settings table is available and yum tries to apply this settings to the Module configuration - before he arrives at the actionStart() of YumInstallController. Will fix this for next revision. removing the settings table manually should do it, too.

edit: fixed this in svn, rev137, please try it ;)

Thanks r137 crosses the first hurdle, but on registration… (Where is ‘header_email_registration’ field in the tbl_YumTextSettings ?)

Error 500

Property "YumTextSettings.header_email_registration" is not defined.

“YumTextSettings.header_email_registration” is not defined.’ in

D:\xampp\htdocs\myWebFolder\blog\framework\base\CComponent.php:131

Stack trace:

#0

D:\xampp\htdocs\myWebFolder\blog\framework\db\ar\CActiveRecord.php(110):

CComponent->__get(‘header_email_re…’)

#1

D:\xampp\htdocs\myWebFolder\blog\protected\modules\user\controllers\YumRegistrationController.php(114):

CActiveRecord->__get(‘header_email_re…’)

#2

D:\xampp\htdocs\myWebFolder\blog\protected\modules\user\controllers\YumRegistrationController.php(72):

YumRegistrationController->sendRegistrationEmail(Object(YumUser))

#3

D:\xampp\htdocs\myWebFolder\blog\framework\web\actions\CInlineAction.php(32):

YumRegistrationController->actionRegistration()

#4 D:\xampp\htdocs\myWebFolder\blog\framework\web\CController.php(300):

CInlineAction->run()

#5

D:\xampp\htdocs\myWebFolder\blog\framework\web\filters\CFilterChain.php(129):

CController->runAction(Object(CInlineAction))

#6 D:\xampp\htdocs\myWebFolder\blog\framework\web\filters\CFilter.php(41):

CFilterChain->run()

#7 D:\xampp\htdocs\myWebFolder\blog\framework\web\CController.php(1049):

CFilter->filter(Object(CFilterChain))

#8

D:\xampp\htdocs\myWebFolder\blog\framework\web\filters\CInlineFilter.php(59):

CController->filterAccessControl(Object(CFilterChain))

#9

D:\xampp\htdocs\myWebFolder\blog\framework\web\filters\CFilterChain.php(126):

CInlineFilter->filter(Object(CFilterChain))

#10 D:\xampp\htdocs\myWebFolder\blog\framework\web\CController.php(283):

CFilterChain->run()

#11 D:\xampp\htdocs\myWebFolder\blog\framework\web\CController.php(257):

CController->runActionWithFilters(Object(CInlineAction), Array)

#12

D:\xampp\htdocs\myWebFolder\blog\framework\web\CWebApplication.php(324):

CController->run(’’)

#13

D:\xampp\htdocs\myWebFolder\blog\framework\web\CWebApplication.php(121):

CWebApplication->runController(‘user/registrati…’)

#14 D:\xampp\htdocs\myWebFolder\blog\framework\base\CApplication.php(135):

CWebApplication->processRequest()

#15 D:\xampp\htdocs\myWebFolder\blog\index.php(11): CApplication->run()

#16 {main} REQUEST_URI=/myWebFolder/blog/index.php/user/registration

Hi,

I’m using this module for my application, one of my requirements is to have the three forms for login/password recovery/registration all in one page in separated TAB.

The landing page with all forms is located at http://localhost/myApp/index.php/user/login the two forms (login and password recovery) are as follow in the rendered html.




<div class="tab-content" id="tab1"> 

 <form id="login-form" action="/myApp/index.php/user/login" method="post">                                     

  <fieldset>

   <label for="UserLogin_username" class="required">Username <span class="required">*</span></label>                                		        

   <input name="UserLogin[username]" id="UserLogin_username" type="text" value="" />

 

   <label for="UserLogin_password" class="required">Password <span class="required">*</span></label>

   <input name="UserLogin[password]" id="UserLogin_password" type="password" value="" />                                    

 

   <input id="ytUserLogin_rememberMe" type="hidden" value="0" name="UserLogin[rememberMe]" />

   <input name="UserLogin[rememberMe]" id="UserLogin_rememberMe" value="1" type="checkbox" /> Remember Me

  

   <input class="button" type="submit" name="yt0" value="Sign In" />                                    

  </fieldset>                                    

 </form>         

</div>

<div class="tab-content" id="tab2"> 

 <form id="forgot-password-form" action="/myApp/index.php/user/recovery" method="post">                                 

  <fieldset> 

   <label for="UserLogin_username" class="required">Username <span class="required">*</span></label>

   <input name="UserLogin[username]" id="UserLogin_username" type="text" value="" />

   <input class="button" type="submit" name="yt1" value="Restore" /> 

  </fieldset>                                    

 </form>   

</div>



When I fill out the password recovery form with a wrong username and I hit the Restore button I get simply redirected to http://localhost/myApp/index.php/user/recovery which contains nothing (I’ve taken out the view for the recovery controller). What I want is that the controller will reload the login form, bringing the focus on the

recovery tab (tab number 2) with the proper error message in it.

this is the php code in the login.php view:




 <div class="tab-content default-tab" id="tab1"> 

 <?php echo CHtml::errorSummary($model,'<a href="#" class="close"><img src="'.Yii::app()->request->baseUrl.'/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a><div>','</div>',array('class'=>'notification error png_bg')); ?>  


 <?php echo CHtml::beginForm(Yii::app()->getModule('user')->loginUrl,'post',array('id'=>'login-form')); ?>

 <fieldset>

    <?php echo CHtml::activeLabelEx($model,'username'); ?>

    <?php echo CHtml::activeTextField($model,'username') ?>

    

    <?php echo CHtml::activeLabelEx($model,'password'); ?>

    <?php echo CHtml::activePasswordField($model,'password') ?>

    

    <?php echo CHtml::activeCheckBox($model,'rememberMe'); ?> Remember Me                                	

    <?php echo CHtml::submitButton(UserModule::t("Sign In"),array('class'=>'button')); ?>

 </fieldset>                                    

 <?php echo CHtml::endForm(); ?>

</div>

<div class="tab-content" id="tab2">

  <?php echo CHtml::errorSummary($model,'<a href="#" class="close"><img src="'.Yii::app()->request->baseUrl.'/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a><div>','</div>',array('class'=>'notification error png_bg')); ?>  


  <?php echo CHtml::beginForm(Yii::app()->getModule('user')->recoveryUrl,'post',array('id'=>'forgot-password-form')); ?>

  <fieldset>

    <?php echo CHtml::activeLabelEx($model,'username'); ?>

    <?php echo CHtml::activeTextField($model,'username') ?>

    <?php echo CHtml::submitButton(UserModule::t("Restore"),array('class'=>'button')); ?>

  </fieldset>                                    

  <?php echo CHtml::endForm(); ?>

</div>



I really hope there is a solution and I won’t be forced to have everything in separated pages.

Thanks.

You can change the behavior in the controllers/YumRegistrationController.php in actionRecovery();

just write your own RegistrationController that extends YumRegistrationController and overwrite the Recovery action as needed.

Any pages from this module seems to use the default yii layout instead of the theme used by the project. How can this be changed?

with this configuration options:

public $layout = ‘yum’;

public $loginLayout = ‘yum’;

public $adminLayout = ‘yum’;

just set these to ‘//layouts/my_custom_layout’ and yum will use this layout instead.

be sure to use the latest svn for this feature to work.

@thyseus, good to know there’s such feature. I’ll wait for release :) Hope there’ll be one soon.

i will add even more new features this month (avatar image upload, profile visit history already done, see svn)

cause i need them for a personal project now. after that i will do a one-week feature freeze where this things

will be tested. this feature freezed version will be available as a release canidate then (yum-0.8rc1). After

this test week, i will release 0.8 to the public. This may me in the middle of October maybe.

Hi thyseus,

I have a question about the module… :)

I need to use different structures for the tables "users" and "profile".

I must alterate the core of the module and loose the possibility of updating the current version with a newest?

What’s the best way to achieve this?

Thanks!

Here is a real-life example on how i do it:




class User extends YumUser {

	public function relations() {

		$relations = array_merge(parent::relations(), array(

					'sector' => array(self::BELONGS_TO, 'Sector', 'sector_id')));

	$relations = array_merge(parent::relations(), array(

					'events' => array(self::HAS_MANY, 'Events', 'owner_id')));


		return $relations;


	}

  public function rules() {

            $rules = parent::rules();

          $rules[] = array('sector_id', 'safe');

          return $rules;




}



simply extend your application-specific rules from YumUser. This is why we call it YumUser and not simply User. i highly suggest that everyone extends from YumUser and implements his application-specific logic in the application. I could write a documentation in depth how that works, but everyone who is able to develop OOP in php should be able to do it for himself. Good luck ;) if you have questions, just ask me, i could take them to a FAQ later on.

Yii-user-management NEEDS good documentation. A whole lot of features are available but not documented yet. I am no native-english speaker so it’s difficult for me tow rite good documentation. Any volunteers? :)

Ok, so then I should also create my UserController that extend YumUserController, right?

( My "users" table is a bit different from yours… for example, the "username" field is not present, that means I must override all the CRUD operations too)

Thank you!

you could also look at ENABLE_REGISTRATION_BY_EMAIL and LOGIN_BY_EMAIL which are features of yum (see latest svn)

I’ve installed rev 154 from svn. I have a requirement for users to be able to create users and manage the ones they create. I noticed in my testing that a user that can manage other users can make them a superuser or can allow them to administer any user including users that are superusers. So a non-superuser could easily make himself a superuser if he can manage other users.

Is this part of the extension still being developed?

yes, i still develop this part of this Module.

I plan to rethink this whole "which user can administer which other users" thing. I think of the following principle:

1.) remove the existing user_has_user and role_has_role subsystem

2.) add a new ‘actionPermission’ (or similar) table that looks like the following:

type - can be "role" or "user"

admin_id - WHO can administer

administred_id - WHO can be administraetd

permission - WHAT can be done (update user, change profile data, remove user, message writing,…)

3.) example:

imagine a dataset like:

type "role", admin_id "5", administered_id "7" and permission "update user"

this now means that every user of role 5 can update every users that have role 7.

this way should be much more flexible than the existing system.

do you have any additional ideas/thoughts about this? am i missing something?

i would start the implementation instantly, cause i need this for a real-life project at the moment, too.

it shouldn´t take too long to have a first alpha-release for testing.

edit: and of course if you want i can give you SVN commit access to the google code repository, any help is appreciated of course!!