[Module] Yii User Management Module

Hey guys,

installed YUM on a simple default blog installation. Got everything up and running and have setup some sample users, but when I click "Upload avatar image" on the currently logged in user I get a 404 error:

not sure what’s going on, all of the other internal links/urls are working.

Any ideas?

hello

a newbie question–how do i assign roles at registration in this module

I have a problem with the user search and the pagination. I want to add a dropdownbox with the a new field (country) from the yum_profile table.

So i added a new dropdownbox with some countries and a join criteria (LEFT JOIN with yum_profile on user_id=id) and a where clause for yum_profile.country. The search works and only the users from the dropdownlist-country will be shown. Pagination works on the first site (result: 1-2 of 2) but when i click page 2 it will show all pages (1-4 of 4) and will ignore the country clause.

And how can i add a new sortableAtrribute "country"?

What can i do?

Today i got same error. Can anyone of developers or users help to fix that?

@w00tw00t111 and @subzero123:

Please try with the latest version from SVN.

http://code.google.com/p/yii-user-management/wiki/InstallationInstructions

If after following this tutorial you still have issues please write back again.

@chirvo,

Thank you for your reply. YUM was installed on the 24th with the latest SVN download and used the wiki’s instructions. From the change log it looks like the most recent commits were on the 23rd so I believe I am using the most up to date source.

@ilpepe82, I think the best person to reply your question is thyseus. Let’s wait for him to answer it.

@w00tw00t111,

Gonna do a fresh install from scratch of YUM and gonna test it to try to replicate your issue. Stay tuned. :)

@chirvo: thx. i solved it with sessions now, with post it always lost the data and get is ugly :)

i have another problem: after i deleted a user it sets the status to -2 -> ok, but the email still remains in the system so you can not register with this email. is this a good logic? is there a workaround or should i clear the profile.email field after deleting a user?

Hello! First - thanks to the thyseus for this great work. It’s very impressive. Go on please! :)

At second - sorry for unfinished links in post. Engine of this site doesn’t allow me to post links because it’s “one of my first posts” (what’s an idiotic reason).

When i perform install YUM on clean webapp created by yiic,i met next troubles:

  1. Why i see this default layout which doesnt have even meny to YUM functions? By calling _ttp://my_web_app/index.php i see next view:

_ttp://img829.imageshack.us/img829/9543/snap146.jpg

If i’m not logged in, and i call _ttp://my_web_app/index.php?r=user/user/admin i go to the auth view and when i authenticate as admin/admin i see normal view:

_ttp://img96.imageshack.us/img96/6555/snap148.jpg

  1. What’s wrong with invitation to friends? I’ve created another user, not superuser, with active status. And when i press on “Add as friend” (being on the page with his profile - _ttp://my_web_app/index.php?r=profile/profile/view&id=3), i get next error:

Error 404

Unable to resolve the request "profile/friendship/invite".

_ttp://img12.imageshack.us/img12/2687/snap149.jpg

  1. I downloaded quite new version of framework - yii-1.1.10.r3566.tar.gz.

And also i use newest YUM - yii-user-management_0.8rc5

I found that in wiki installation instruction there is a text block:

Well, but how should be routing set up if i use clean webapp just "from the box"?

I’m upset with difficulties i confront, but probably i hope it’s me doing something wrong. But anyway coombination of Yii and Yum “as is” doesn’t work good in my case, as i described earlier. I wonder how other users don’t have same difficulties with this and I ask for some help, guys.

I also forgot to say:

when i just created webapp with yiic, i took schema.mysql.sql from yii\demos\blog\www\protected\data\ and imported it into my database. But as it seems it doesn’t affect the YUM. I had only 5 tables with prefix “tbl” - “tbl_lookup”, “tbl_tag” and others. I deleted them and nothing happened so i think it’s not important, but anyway :rolleyes:

i just went back from vacation and moving back to my

work; i am glad much has happened here in just 1 week.

@Statuss: Thanks for the russian translation; i will

include it in the svn. There are already some russian

strings, but since they are very old, i will simply

replace them with yours.

@Chirvo: Yes, a 0.8 release would be a good idea.

When my current project (that uses yum and will still

modify and enhance yum while being developed) is done,

i will package the version.

in the meantime, please use the SVN repository at google

code.

@Subzero:

  1. the layout that yum uses for rendering its views can be

defined in the appropriate module, see

UserModule, ProfileModule.php, RoleModule.php, and so on.

  1. there, a link is wrong. it needs to be

friendship/friendship/invite. its fixed in the svn.

3.) schema: please use the installation; the

schema.mysql.sql is outdated and will be removed

Thanks for answer, thyseus.

Ok. I made a checkout as was recommended:


# Non-members may check out a read-only working copy anonymously over HTTP.

svn checkout http://yii-user-management.googlecode.com/svn/trunk/ yii-user-management-read-only



Now when i login as admin and go to _ttp://my_web_app/index.php?r=user/user/admin i get next error:


Fatal error: Call to a member function get() on a non-object in Z:\home\my_web_app\www\protected\modules\user\models\YumUser.php on line 365

Roger that. I will not use this schema from demo app, just follow YUM installation steps.

But what about routing?

how should be routing set up if i use clean webapp?

Your notice would be very appreciated.

Routing is disabled at the default yiic webapp, but many people enable it right afterwards. With this note in the Documentation, both methods are covered.

Can you attach a full stack trace for the new error with the SVN version, please?

Ok, got this about routing, ty.

And about stack trace - actually there is only this line with error


Fatal error: Call to a member function get() on a non-object in Z:\home\my_web_app\www\protected\modules\user\models\YumUser.php on line 365

Ok that was my mistake. Sorry.

In latest installation instuction i found note about neccessary enabling cache component.

I enabled it and now i get:

[size="5"][color="#FF0000"]CException[/color][/size]

[size="4"]Property "RoleModule.rolesTable" is not defined.[/size]

Z:\home\yii\framework\base\CModule.php(483)


471         }

472     }

473 

474     /**

475      * Configures the module with the specified configuration.

476      * @param array $config the configuration array

477      */

478     public function configure($config)

479     {

480         if(is_array($config))

481         {

482             foreach($config as $key=>$value)

483                 $this->$key=$value;

484         }

485     }

486 

487     /**

488      * Loads static application components.

489      */

490     protected function preloadComponents()

491     {

492         foreach($this->preload as $id)

493             $this->getComponent($id);

494     }

495 

Stack Trace

#0

  • Z:\home\yii\framework\base\CModule.php(483): CComponent->__set("rolesTable", "role")

#1

  • Z:\home\yii\framework\base\CModule.php(87): CModule->configure(array("rolesTable" => "role", "userHasRoleTable" => "user_role", "actionTable" => "action", "permissionTable" => "permission"))

#2

  • Z:\home\yii\framework\YiiBase.php(208): CModule->__construct("role", null, array("rolesTable" => "role", "userHasRoleTable" => "user_role", "actionTable" => "action", "permissionTable" => "permission"))

#3

  • Z:\home\yii\framework\base\CModule.php(283): YiiBase::createComponent("role.RoleModule", "role", null, array("rolesTable" => "role", "userHasRoleTable" => "user_role", "actionTable" => "action", "permissionTable" => "permission"))

#4

– Z:\home\my_web_app\www\protected\modules\user\models\Yum.php(153): [b]CModule->getModule/b


148     }

149 

150     // returns the yii user module. Mostly used for accessing options

151     // by calling Yum::module()->option

152     public static function module($module = 'user') {

153         return Yii::app()->getModule($module);

154     }

155 

156     public static function hasModule($module) {

157         return array_key_exists($module, Yii::app()->modules);

158     }

#5

– Z:\home\my_web_app\www\protected\modules\user\models\YumUser.php(379): [b]Yum::module/b


374                 $relations['managed_by'] = array(

375                         self::HAS_MANY, 'YumPermission', 'subordinate_id');

376 

377                 $relations['roles'] = array(

378                         self::MANY_MANY, 'YumRole',

379                         Yum::module('role')->userRoleTable . '(user_id, role_id)');

380 

381             }

382 

383             if (Yum::hasModule('messages')) {

384                 Yii::import('application.modules.message.models.*');

#6

  • Z:\home\yii\framework\db\ar\CActiveRecord.php(2289): YumUser->relations()

#7

  • Z:\home\yii\framework\db\ar\CActiveRecord.php(379): [b]CActiveRecordMetaData->__construct/b

#8

– Z:\home\my_web_app\www\protected\modules\user\models\YumUser.php(49): [b]CActiveRecord::model/b


44                     'class' => 'application.modules.user.components.CAdvancedArBehavior'));

45     }

46 

47     public static function model($className = __CLASS__)

48     {

49         return parent::model($className);

50     }

51 

52     public function delete()

53     {

54         if (Yum::module()->trulyDelete)

#9

  • Z:\home\my_web_app\www\protected\modules\user\controllers\YumAuthController.php(153): [b]YumUser::model/b

#10

  • Z:\home\my_web_app\www\protected\modules\user\controllers\YumAuthController.php(264): [b]YumAuthController->loginByUsername/b

#11

  • Z:\home\yii\framework\web\actions\CInlineAction.php(50): [b]YumAuthController->actionLogin/b

#12

  • Z:\home\yii\framework\web\CController.php(309): CInlineAction->runWithParams(array("r" => "user/auth/login"))

#13

  • Z:\home\yii\framework\web\filters\CFilterChain.php(134): [b]CController->runAction/b

#14

  • Z:\home\yii\framework\web\filters\CFilter.php(41): [b]CFilterChain->run/b

#15

  • Z:\home\yii\framework\web\CController.php(1146): [b]CFilter->filter/b

#16

  • Z:\home\yii\framework\web\filters\CInlineFilter.php(59): [b]CController->filterAccessControl/b

#17

  • Z:\home\yii\framework\web\filters\CFilterChain.php(131): [b]CInlineFilter->filter/b

#18

  • Z:\home\yii\framework\web\CController.php(292): [b]CFilterChain->run/b

#19

  • Z:\home\yii\framework\web\CController.php(266): CController->runActionWithFilters(CInlineAction, array("accessControl"))

#20

  • Z:\home\yii\framework\web\CWebApplication.php(276): [b]CController->run/b

#21

  • Z:\home\yii\framework\web\CWebApplication.php(135): [b]CWebApplication->runController/b

#22

  • Z:\home\yii\framework\base\CApplication.php(162): CWebApplication->processRequest()

#23

  • Z:\home\my_web_app\www\index.php(13): CApplication->run()

in the SVN version all table names have been changed from plural to singular.

its now roleTable.

please use this in your config/main.php for the table association or wherever

roleTable is used…

@subzero123:

A quick recommendation: If you’re adopting YUM for your project and you just started with it please reinstall YUM, delete all the configuration you did, download it from the SVN repository and reconfigure it again.

And please stick to the instructions posted in the installation tutorial page on the project’s wiki. If you follow them to the letter you will have a 100% functional YUM installation in your project.

Well, as i see, installing and setting up YUM becomes more and more confusing. Like a puzzle, huh? :rolleyes:

Ok.

In main.php there was a line:


'role' => array(

	'rolesTable' => 'role',

	'userHasRoleTable' => 'user_role',

	...



i fixed it from "rolesTable" to "roleTable".

And got next error:

[size="5"][color="#FF0000"]CException[/color][/size]

[size="4"]Property "RoleModule.userHasRoleTable" is not defined.[/size]

Z:\home\yii\framework\base\CModule.php(483)


471         }

472     }

473 

474     /**

475      * Configures the module with the specified configuration.

476      * @param array $config the configuration array

477      */

478     public function configure($config)

479     {

480         if(is_array($config))

481         {

482             foreach($config as $key=>$value)

483                 $this->$key=$value;

484         }

485     }

486 

487     /**

488      * Loads static application components.

489      */

490     protected function preloadComponents()

491     {

492         foreach($this->preload as $id)

493             $this->getComponent($id);

494     }

495 

Stack Trace

#0

  • Z:\home\yii\framework\base\CModule.php(483): CComponent->__set("userHasRoleTable", "user_role")

#1

  • Z:\home\yii\framework\base\CModule.php(87): CModule->configure(array("roleTable" => "role", "userHasRoleTable" => "user_role", "actionTable" => "action", "permissionTable" => "permission"))

#2

  • Z:\home\yii\framework\YiiBase.php(208): CModule->__construct("role", null, array("roleTable" => "role", "userHasRoleTable" => "user_role", "actionTable" => "action", "permissionTable" => "permission"))

#3

  • Z:\home\yii\framework\base\CModule.php(283): YiiBase::createComponent("role.RoleModule", "role", null, array("roleTable" => "role", "userHasRoleTable" => "user_role", "actionTable" => "action", "permissionTable" => "permission"))

I also fixed there (transformed plural names to singular):

‘usersTable’ to ‘userTable’,

‘messagesTable’ to ‘messageTable’,

‘usergroupMessagesTable’ to ‘usergroupMessageTable’,

‘profileFieldsTable’ to ‘profileFieldTable’

‘profileFieldsGroupTable’ to ‘profileFieldGroupTable’

But this error doesn’t dissapear.

Yes I’m guilty. :D