/** * Mark a comment as deleted * NOTE: Does not actually delete data. Simply marks record. * * @return void */ protected function _delete() { // Ensure the user is logged in if (User::isGuest()) { $this->_login(); } // Incoming $id = Request::getInt('comment', 0); if (!$id) { return $this->_redirect(); } // Initiate a comment object $comment = \Components\Courses\Models\Comment::oneOrFail($id); if (User::get('id') != $comment->get('created_by') && !$this->params->get('access-delete-comment')) { App::redirect($this->url); } $comment->set('state', $comment::STATE_DELETED); // Delete the entry itself if (!$comment->save()) { $this->setError($comment->getError()); } App::redirect($this->url, Lang::txt('PLG_COURSES_REVIEWS_REMOVED'), 'message'); }