|
API
Application Programming Interface
Featured User data@param user id not required (default return current user) $userObject = Yii::app()->getModule('user')->user(); // Public Properties: id, username, email, createtime, lastvisit and profile relation
$profileObject = $userObject->profile; // Your custom fields (Default: firstname, lastname, about)Is admin@return true or false Yii::app()->getModule('user')->isAdmin()Access control@return array superusers names Yii::app()->getModule('user')->getAdmins()Example controller public function accessRules()
{
return array(
array('allow', // allow all users to perform 'index' and 'view' actions
'actions'=>array('index','view'),
'users'=>array('*'),
),
array('allow', // allow authenticated user to perform 'create' and 'update' actions
'actions'=>array('create','update'),
'users'=>array('@'),
),
array('allow', // allow admin user to perform 'admin' and 'delete' actions
'actions'=>array('admin','delete'),
'users'=>Yii::app()->getModule('user')->getAdmins(),
),
array('deny', // deny all users
'users'=>array('*'),
),
);
}See FieldWidget |
► Sign in to add a comment
I am trying get atributes (username, id) with $userObject = Yii::app()->getModule('user')->user(); in SiteController? action upload and always return user guest.
thx
How do I change language in yiiuser extensions?? Please help me!
in /protected/config/main.php add
return array( 'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..', 'name'=>'My Web Application', ... 'language'=>'sk', //-- add your language code here ... // preloading 'log' component 'preload'=>array('log'),Doesn't the language work if it's have a ""?
config/main.php 'language' => 'pt_br',
$ cat protected/modules/user/messages/pt_br/user.php | grep profile
<?php echo UserModule?::t('Edit profile'); ?> == Edit profile
I'm using this:
$userObject = Yii::app()->getModule('user')->user(); $profileFields = $userObject->profile;
but, it send me error at: Trying to get property of non-object .
I saw that Yii don't know $userObject & $profileFields. Someone can help me plz ?
For some reasons, the file upload widget doesn't work the first time when people register. However, after they registered, they are able to upload the profile photos. Bug?
I’ve recently installed the yiiuser extension and I am trying to customise the registration form instead of using the auto generated one.
I am trying to use create a drop down list using the same functionality the extension uses.
1.yii user code 2.} elseif ($field->range) { 3. echo $form->dropDownList($profile,$field->varname,Profile::range($field->range));yii user code } elseif ($field->range) {
so my code looks like this:1. labelEx($profile,'altType'); ?> 2. dropDownList($profile,'altType',Profile::range($profile->altType->range)); ?> 3. error($profile,'altType'); ?> labelEx($profile,'altType'); ?>
I got the label and drop down appearing on my new form, but the dropdown is empty.
What am I missing?