Exemplo n.º 1
0
 /**
  * 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()) {
         return $this->_login();
     }
     // Incoming
     $id = Request::getInt('comment', 0);
     if (!$id) {
         return $this->_redirect();
     }
     // Initiate a blog comment object
     $comment = new \Plugins\Hubzero\Comments\Models\Comment($id);
     if (User::get('id') != $comment->get('created_by') && !$this->params->get('access-delete-comment')) {
         App::redirect($this->url);
         return;
     }
     $comment->set('state', 2);
     // Delete the entry itself
     if (!$comment->store()) {
         $this->setError($comment->getError());
     }
     App::redirect($this->url, Lang::txt('PLG_HUBZERO_COMMENTS_REMOVED'), 'message');
 }