Thursday, April 18, 2013


 

 

 

 

Features of Yii-User

  • Login from User Name or Email
  • Registration
  • Activation accounts (verification email)
  • Recovery password (send recovery key to user email)
  • User profile page
  • Manage Users
  • Manage Profile Fields
  • Profile field widget for view, edit and save data (FieldWidget)
  • Date widget (jQueryUI datepicker)
  • File upload widget
  • Profile Relation Widget
  • API

1.Download YII-user from this link http://www.yiiframework.com/extension/yii-user/

2. then go your webapp folder & open protect make folder name modules  past user on folder

4. open config & click main.php in your protect folder

5. to creat data base , open data folder in YIIUSER modules & run schema.mysql
make sure remove cooment in

'db'=>array(
            'connectionString' => 'mysql:host=localhost;dbname=database name',
            'emulatePrepare' => true,
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
                      'tablePrefix' => 'tbl_',


6. update main.php using this code



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'),
                ),
#...
        ),
#...
);
 
 
 
then save & open your view main.php page (protect/view/layout/main.php
 
 
copy follow  code &  update your nav code
 
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), 
 
 
then run local host you can see you new login form 
 
 
Login
Default users:
  • admin/admin
  • demo/demo

 
 
 
 
 
 
 
 
 
 
 
 

 
 
 
 
    

0 comments:

Post a Comment

Subscribe to RSS Feed Follow me on Twitter!