public function actionRemoveUser($id) { $model = $this->loadModel($id); $pieces = explode(', ', $model->assignedTo); $pieces = Quote::editUsersInverse($pieces); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Quote'])) { $temp = $model->attributes; $model->attributes = $_POST['Quote']; $arr = $model->assignedTo; foreach ($arr as $id => $user) { unset($pieces[$user]); } $temp = Quote::parseUsersTwo($pieces); $model->assignedTo = $temp; $changes = $this->calculateChanges($temp, $model->attributes); $model = $this->updateChangelog($model, $changes); if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('addUser', array('model' => $model, 'users' => $pieces, 'action' => 'Remove')); }