Admin view by loggin in user?

How and where would I setup the admin section to ONLY view the records associated with the logged in users ID?

I am already passing the id in Yii::app()->user->id…

I want to say

<?php if($model->memberId === Yii::app()->user->id){?>

  List those records 

Where do I make that change?? In the model, view, or the controller??? And how?

I think I figured out where to do this but it doesnt work!!!

public function actionIndex()


	&#036;dataProvider=new CActiveDataProvider('Member', array(


	         'condition'=&gt;'memberId === Yii::app()-&gt;user-&gt;id',




???????????? When I do that, it brings back everything not just the current user id… it shouldnt be pulling all that data though

Hmmmm actually can I do this via calling the search action??? and when the user logs into the admin page it searches automatically and shows only thier items????

Don’t think it’s a good idea the above.

What you are going to do is in the controller of the your first though is correct.

CDbCriteria should look like.

$criteria=new CDbCriteria(array(

'condition'=>'status= :memberidparameter',

'params'=>array(':memberidparameter'=>$memb) , //i am not sure if the must be an array there.


What this differs from yours and think this is the error is

public function actionIndex()


$dataProvider=new CActiveDataProvider('Member', array(


'condition'=>'memberId [size="4"]===Yii::app()->user->id [/size]',



don’t forget tha the condition is

so === don’t help and finally if it would you then going to make this equal with the string Yii::app()->user->id NOT the val.

This is why you have it in ‘’ and not outside.