assigning permission to user problem

In user management module of yii when i assign permission to user it produces following error but it work well when i’m assigning permission to any role any one can help…

 public static function encode($text)


     return htmlspecialchars($text,ENT_QUOTES,Yii::app()->charset);


Hi and welcome to the forum

your question is not at all clear

If you want to get help you need to explain better your problem… in other words… you need to help us understand your problem so that we can help you.

You mention "folowing error" but did not write the error…

what is the user managment model of yii? any link?

you have problem with assigning permission but the code you provided is just used for encoding…

Hi this is the error but it is somewhere in helper class (C:\wamp\www\yii\framework\web\helpers\CHtml.php(66))

htmlspecialchars() expects parameter 1 to be string, object given and this is the function

public static function encode($text)


    return htmlspecialchars($text,ENT_QUOTES,Yii::app()->charset);


it happens with user management in user management module of yii…

and this is name of that module easily downloadable(yii-user-management_0.8rc5)


or do you have any suggestion for implementing role based access control for

user’s in yii…

I know the model is easily downloadable… but I don’t need it and don’t have time for that…

The problem is in the parameter that is sent to the encode function… so it’s completely useless to post the encode function source…

you need to check where this function is called… and what value is sent to it.

It happened to me also. It seems the error is in /modules/role/views/role/admin.php because the error message shows up when I go to

role/views/permission/admin page.

$this->widget('zii.widgets.grid.CGridView', array(




			'name' => 'title',

			'type' => 'raw',

			'value'=> 'CHtml::link(CHtml::encode($data->title),










CHtml::encode function was used, and $data->title needs to be a string, but $data->title seem to be an object.

Why $data->title returns an object?