Installation
- Unpack files in your project/protected
- Insert to config/main.php
return array(
#...
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
'application.modules.user.models.*',
'application.modules.user.components.*',
),
#...
'modules'=>array(
'user',
),
#...
// application components
'components'=>array(
#...
'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>true,
'loginUrl' => array('/user/login'),
),
#...
),
#...
);Create tables (dump files schema.mysql.sql and schema.sqlite.sql) Insert items into zii.widgets.CMenu array (protected/views/layouts/main.php) array('url'=>Yii::app()->getModule('user')->loginUrl, 'label'=>Yii::app()->getModule('user')->t("Login"), 'visible'=>Yii::app()->user->isGuest),
array('url'=>Yii::app()->getModule('user')->registrationUrl, 'label'=>Yii::app()->getModule('user')->t("Register"), 'visible'=>Yii::app()->user->isGuest),
array('url'=>Yii::app()->getModule('user')->profileUrl, 'label'=>Yii::app()->getModule('user')->t("Profile"), 'visible'=>!Yii::app()->user->isGuest),
array('url'=>Yii::app()->getModule('user')->logoutUrl, 'label'=>Yii::app()->getModule('user')->t("Logout").' ('.Yii::app()->user->name.')', 'visible'=>!Yii::app()->user->isGuest),Login
Default users:
Module parameters
| Property | Type | Description | Default |
| user_page_size | int | items on page | 10 |
| fields_page_sizeint | items on page | 10 |
| hash | string | hash method | md5 |
| sendActivationMail | boolean | use email for activation user account | true |
| loginNotActiv | boolean | allow auth for is not active user | false |
| activeAfterRegister | boolean | activate user on registration (only $sendActivationMail = false) | false |
| autoLogin | boolean | login after registration (need loginNotActiv or activeAfterRegister = true) | true |
| registrationUrl | array | regitration path | array("/user/registration") |
| recoveryUrl | array | recovery path | array("/user/recovery/recovery") |
| loginUrl | array | login path | array("/user/login") |
| logoutUrl | array | logout path | array("/user/logout") |
| profileUrl | array | profile path | array("/user/profile") |
| returnUrl | array | return path after login | array("/user/profile") |
| returnLogoutUrl | array | return path after logout | array("/user/login") |
| relations | array | User model relation from other models | array() |
| profileRelations | array | Profile model relation from other models | array() |
| captcha | array | use captcha | array('registration'=>true) |
| tableUsers | string | User model table | {{users}} |
| tableProfiles | string | Profile model table | {{profiles}} |
| tableProfileFields | string | ProfileField model table | {{profiles_fields}} |
Missing 'tablePrefix' => 'tbl',
'Create User' operation produces following error:
"Undefined variable: list"
Url: /index.php?r=user/admin/create
Script: \protected\modules\user\views\admin\menu.php(3)
00001: <ul class="actions"> 00002: <?php 00003: if (count($list)) { 00004: foreach ($list as $item) 00005: echo "<li>".$item."</li>"; 00006: } 00007: ?>When clicking on "Login" or "Registration" I get this error : Non-static method UserModule?::t() should not be called statically, assuming $this from incompatible context
any idea ?
The ProfileField section is not documented. The "range" field is useful to be able to have a field with a ComboBox which is nice, however the format of how this is specified is not documented. The format is:
1==Active;2=Inactive;3=Other
This would give a ComboBox in the following format:
Although this is GREAT, it would be better to be able to have a ComboBox using a lookup into a table. I made some changes to have this functionality by specifying the "Range" field with this alternative format:
&Table;IdField;NameField;Module
The initial "&" is for the system to Identify this new format. An Example
&Country;country_id;country_name;admin
The Module is optional and is used if the table is in another module.
for this to work, I replaced the following 2 functions that are in the file "application\protected\modules\user\models\profile.php"
private function rangeRules($str) { if (substr($str,0,1)=='&') { // es comando $params = explode(';', substr($str,1)); if (isset($params[3])) Yii::app()->getModule($params[3]); $rules = CHtml::listData($params[0]::model()->findAll(), $params[1], $params[1]); } else { $rules = explode(';',$str); for ($i=0;$i<count($rules);$i++) $rules[$i] = current(explode("==",$rules[$i])); } return $rules; } static public function range($str,$fieldValue=NULL) { if (substr($str,0,1)=='&') { $params = explode(';', substr($str,1)); if (isset($params[3])) Yii::app()->getModule($params[3]); $array = CHtml::listData($params[0]::model()->findAll(), $params[1], $params[2]); } else { $rules = explode(';',$str); $array = array(); for ($i=0;$i<count($rules);$i++) { $item = explode("==",$rules[$i]); if (isset($item[0])) $array[$item[0]] = ((isset($item[1]))?$item[1]:$item[0]); } } if (isset($fieldValue)) if (isset($array[$fieldValue])) return $array[$fieldValue]; else return ''; else return $array; }I hope this helps if you consider it useful, you might include it in the next version of yiiuser.
Nice module. Thank you for sharing.
I am very new to yii and OOP. I installed your module. It is working well, except that when I create a new user, the password is saved in clear to Db, not hashed. And of course, user cannot login because an error ocurr.
Please fix the following input errors:
If I create an user as admin, the password is hashed and all look to be fine.
I changed next line in RegistrationController? :
$model->verifyPassword=UserModule?::encrypting($model->verifyPassword); if ($model->save()) {Now, the password is saved hashed in DB.
Hello! First of all,thank you for your sharing! It's a really nice module. I've got a problem:
How can I solve it,thank you.
how to setup the layout for this module .. ?
@kasyap5. I had the same problem. not sure is the best solution but I added
on public function beforeControllerAction on the file UserModule?.php (the configuration file module). You can try also removing $layout in Controller.php under components of the main application.
I copied all filed to the proper directories under protected and I am getting an error "Alias "user.UserModule?" is invalid. Make sure it points to an existing PHP file.
hey ... nice module , and it will do all the required tasks of users issue, i have followed the above steps for the installation , i also created the tables in the database , but whenever i login i got the following error : " Fatal error: Call to a member function encrypting() on a non-object in D:\wamp\www\taskmgr\protected\modules\user\components\UserIdentity?.php on line 35 "
advice please !
If you get an "Alias "user.UserModule?" is invalid ERROR, then you simply have to give the necessary rights to php to access the modules directory and it's contents. (Usually happens to users with linux installations). Go to command line in the protected directory and run: chmod -R go+rx modules and you are done.
I'm new with Yii and I've founded your extensión... I'm trying but I've got a problem, sure that's it's easy but I don't know how to show all the text in Spanish.
Can you help me, please?
Thx a million!
I get this error: CDbException
The table "{{users}}" for active record class "User" cannot be found in the database.
Any ideas? How to create this table?
@Laith.B...@gmail.com: Solution to "Fatal error: Call to a member function encrypting() on a non-object in D:\wamp\www\taskmgr\protected\modules\user\components\UserIdentity?.php on line 35"
I was facing the same problem and got the solution. You get this solution when you are trying to login using an URL different from /user/login for example the default Yii login URL i.e. /site/login. It is not able to find the corresponding module hence is not able to call the member function encrypting in that.
Call to a member function encrypting() on a non-object in C:\xampp\htdocs\overdrive\protected\modules\user\components\UserIdentity?.php on line 35 how to solve it?
I have followed all the steps for the installation , i also created the tables in the database , but whenever i login i got the following error : " Fatal error: Call to a member function encrypting() on a non-object
CHANGE LAYOUT from module user to application Guys HELP, user is running as module but If I want to change layout and use application layout and theme how to do it and the best is in dynamic way.
please help Im getting crazy
Getting an error about: "{{users}}"?
Missing instructions; after running the SQL statements, go into protected/modules/user/UserModule?.php and edit lines 78-80.
When use this module, you must add to urlManager next rule: 'urlManager'=>array(
.................),
else pages like: Edit, Change Password will not be shown when click on their links.
Getting an error about: "{{users}}"
You don't have to edit 'protected/modules/user/UserModule?.php'. You can configure the table names in 'protected/config/main.php'.
'modules' => array( ... 'user' => array( 'tableUsers' => 'tbl_users', 'tableProfiles' => 'tbl_profiles', 'tableProfileFields' => 'tbl_profiles_fields', ), .... ),This is an awesome extension!
I do have a question, though. Some users are "admins" (superusers?) how do I check a specific user for that property? Just like "isGuest", is there a method to verify if the user is an administrator? "isAdmin" does not work.
I can't find any documentation about this at all. Sorry if this is in the wrong place.
Thanks!
Dear author, add possibility of change of Layout, for example as in the Right module (layout & appLayout)
Hi, this module looks really promising, but I'm having an issue installing... perhaps because i'm using version 1.1.7 of yii?
I followed the given instructions, and get the following message;
Fatal error: Call to a member function t() on a non-object in C:\yiiweb\userauth\protected\views\layouts\main.php on line 37
The line that triggers this is:
Is there something I have failed to configure? I have tried this with "'tablePrefix' => 'tbl'," in the db connection array, but to no avail. I have even renamed the tables to exclude the "tbl".
Any suggestions?
Follow-on to "Fatal error: Call to a member function t() on a non-object "
I just re-installed, but on a php 5.2 computer, and this time everything works great!
Will re-examine the install on the php 5.3 config.
I'm having the same problem that the person above me did. Though, I've checked and mine is installed on a server running php 5.2, but I still get this error. Is there something else I'm doing wrong? I added the db 'tablePrefix' => 'tbl' but it's still not working and just gives me the error when I try to add it to my nav area.
Any fixes?
Sorry, I meant to mention, the error I get is the one with calling a member function t() on a non-object. Thought I'd specify.
What worked for me was to add 'tablePrefix' => '' as I'm not using the table name preface.
When i remove the tablePrefix entry, i got the error.
Thanks again to the author for this very useful tool!
Hi, thank you for sharing your work. Im very new to PHP and developing web-apps, therefor Ive got a little problem. I´ve installed the framework, copied the yii-user extension in my project/protected folder and created the databases. It looks like everything goes thru, but if I want to login as admin I got the "Password is incorrect." error. I searched in the directories, changed the pw in the database but nothing helped.
I know a little less information but could anyone give me a hint how I can solve the problem?
Thanks
Hi again in addendum to above. If I create an new user, the created user is affiliated in the "tbl_users". But still the "Password is incorrect." error, even the new user.
For registration on my site a required bool field must be set to yes. How do I validate this?
Hello,
Wonderful extension but I just have a few questions. So far everything works perfectly but the layout on the /user module. The first part is fine (Home, About, Blog and Contact section) but when I click on Login and Register in the menu bar the /views/layouts/main does not render and I am just left with the Login and Register models. I think this has something to do with the controller but I am not sure because I am still pretty new to Yii and I am getting the hang of it. If there is anyone who is familiar with this problem it would be much appreciated if you could weigh in. Thank you.
Hi, nice module! I made some modifications as I wanted it to be able to use the column2 standard Yii layout. I did this on the 0.3-r107 version. If interested, don't hesitate to contact me.
Cheers
atal error: Call to a member function t() on a non-object in ../protected/views/layouts/main.php on line 36
I have tried adding: 'tablePrefix' => 'tbl' or 'tablePrefix' => '' as other users suggested but neither works.
Any ideas? Thanks in advance!!!
For the issues like "The table "{{users}}" for active record class "User" cannot be found in the " please check the URL http://code.google.com/p/yii-user/issues/detail?id=6&can=1&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary%20Reporter#c1
REMEMBER ISSUE ON INSTALLATION 'Insert to config/main.php'
An issue on the installation code: When config the main.php is no correct the sentence to 'user'
It is not correct:
'modules'=>array( 'user', ),It is correct:
'modules'=>array( 'user' => array( 'tableUsers' => 'tbl_users', 'tableProfiles' => 'tbl_profiles', 'tableProfileFields' => 'tbl_profiles_fields', ), ),Bye
Hi great plugin, But Cannot understand, why no one asked about "How to implement Facebook Login" or "OpenId?"? so, please provide answer of "How can I implement FB login And OpenId? login.
9o,o9o8
Re: Fatal error: Call to a member function t() on a non-object in ../protected/views/layouts/main.php on line 36
I'm getting this too ... is it something to do with the default site controller? I've only just created a new webapp, followed the guide above.
If I don't specify a default site controller in config/main.php I get another error.
So, I've tried specifying both 'login' and 'user' and the defaults?
I'm a noob to yii - so hope I'm not being thick! ;)
So it was a Noob error and for other noob's here it is.
Don't take the "insert into config/main.php" step literally. You need to take the parameters for each section and insert them into the correct place in your existing config.
For example, don't just add:
The default config/main.php already has the following defined So add the extra lines before the last ),If you want to see my final config file, you can find it here: http://www.sudwebdesign.com/articles-page/46-yii/106-configuring-yii.html
Hi Friends, I have install this modules and it works fine. but i have create & manage category page,while the access rules only set to 'admin'. The yii modules can set anyone to superadmin & save into database. So i want to set access rules of " create & manage in category controller " to read data from database. so i change access rules code of "CategoryController?.php": Original one : 'actions'=>array('create','update'),
change to : 'actions'=>array('create','update'),
then , i get the error page : "include(UserModule?.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory"
in framework\YiiBase?.php(421) line 421 include($className.'.php');
Thanks Before
Hi! When I Create Profile Field send the next error:
CDbException
CDbCommand failed to execute the SQL statement: SQLSTATE42601?: Syntax error: 7 ERROR: error de sintaxis en o cerca de «(» LINE 1: ALTER TABLE tbl_profiles ADD "rol" INTEGER(10) NOT NULL DEF... ^. The SQL statement executed was: ALTER TABLE tbl_profiles ADD "rol" INTEGER(10) NOT NULL DEFAULT 0
Please help :'(
I'm working with Postgres...
Hey, Just a question about the code. What's the advantage of UActiveForm over CActiveForm? I'm new to yii, but doesn't CActiveForm already support ajax validation? Thanks.
get Trying to get property of non-object while installing I tried all above ideas in vain.
Have been trying to install this module for the past 2 days now. Its throwing up an error
On these lines of codes of the file: \protected\modules\user\controllers\YumInstallController?.php(134): CDbCommand->execute()
if (isset($_POST['installUsergroup'])) { $sql = "CREATE TABLE IF NOT EXISTS `" . $usergroupTable . "` ( `id` int(11) NOT NULL AUTO_INCREMENT, `owner_id` int(11) NOT NULL, `participants` text NULL, `title` varchar(255) NOT NULL, `description` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; $db->createCommand($sql)->execute(); //throws exception on this line. $createdTables['usergroup']['usergroupTable'] = $usergroupTable;I have tried to use the line of code
before running the queries. Any help would be appreciated. Thanks!
how to change the language pls? i see there are a few in the message box, but how to config it pls?
I am gettting an error: Property "CWebUser.tableUsers" is not defined.
In my config/main.php
'components'=>array(
And:
'db'=>array(
Any thoughts?
i dont understand about installation..it said that "Create tables (dump files schema.mysql.sql and schema.sqlite.sql) " means that we need the tables name schema.mysql.sql and schema.sqlite.sql ? the attribute in the table should insert username, password and so on...?
I had the "called to member function on a none object" problem like many others.
Since I'm newb on MVC it took me some time to realise I was missing
$profile= new Profile; on row 25 in modules/user/views/profile/edit.php
An Idea, change "tbl_users" to tbl_user by default, to fit better with default yii app and the popular "rights". Not a big problem, it was easy to change even for me but I don't thnink I'm the only one wants to use them together=)
Last but not least, thank you so much for this epic module. This was all I wanted and much more! Awesome!
I've installed yii user but i got http 500 error. why?
If I create a profile field called "agency_id" that has a relationship to an "agency" table, how can I get the registration form to automatically generate a pull down menu of the agencies?
contacon - thank you for posting the correct module entry.
Hi!
The modul is work, but dont include the controller the css, js and html sources. What is the probleme?
/i get foloowing error:
Property "UserModule?.debug" is not defined.
What am I doing wrong?
Fatal error: Call to a member function t() on a non-object in C:\xampp\htdocs\my_project\protected\views\layouts\main.php on line 34
Any ideas?