/** * 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'); }
$comment->set('created_by', !User::isGuest() ? User::get('id') : 0); $comment->set('anonymous', !User::isGuest() ? 0 : 1); } ?> <img src="<?php echo $comment->creator()->getPicture($comment->get('anonymous')); ?> " alt="" /> </p> <fieldset> <?php if (!User::isGuest()) { if ($replyto = Request::getInt('commentreply', 0)) { $reply = new \Plugins\Hubzero\Comments\Models\Comment($replyto); $name = Lang::txt('COM_KB_ANONYMOUS'); if (!$reply->get('anonymous')) { $name = ($reply->creator('public') ? '<a href="' . Route::url($reply->creator()->getLink()) . '">' : '') . $this->escape(stripslashes($repy->creator('name'))) . ($reply->creator('public') ? '</a>' : ''); } ?> <blockquote cite="c<?php echo $reply->get('id'); ?> "> <p> <strong><?php echo $name; ?> </strong> <span class="comment-date-at"><?php echo Lang::txt('COM_ANSWERS_AT'); ?>