Hi guys,
I’m new in Yii and I need some help. I’m using the Rights extension and I would want that a user can see just his own post in the Manage Page (actionAdmin). I tried to do it in the postController:
public function actionAdmin()
{
$model = $this->loadModel($id);
$userId = Yii::app()->user->id;
if ($this->loadModel($id)->id_user == $userId)
{
$model=new Post('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Post']))
$model->attributes=$_GET['Post'];
$this->render('admin',array(
'model'=>$model,
));
}
}
I think there’s some problem in the loadModel
It’s work using the updateAction, deleteAction and viewAction.