Delete comment. Works similar as 'wp_ajax_delete_comment',
but this allows all user roles to delete their own comments.
@return void
330616
public function removeComment()
    {
        $id = isset($_POST['id']) ? (int) $_POST['id'] : 0;

        if (!$comment = get_comment($id)) {
            wp_send_json_error('Comment is missing');
        }

        if (!current_user_can('edit_comment', $comment->comment_ID) && !($comment->user_id == get_current_user_id())) {
            wp_send_json_error('Missing authorization');
        }

        // Validate nonce
        if (!check_ajax_referer("delete-comment_$id", 'nonce', false)) {
            wp_send_json_error('Nonce failed');
        }

        $trashed = wp_trash_comment($comment);
        if ($trashed) {
            wp_send_json_success('Deletion was successful');
        }

        wp_send_json();
    }
504151
public function deleteComment($id): bool
    {
        $commentableModel = $this->commentableModel();

        return (bool) (new $commentableModel())->deleteComment($id);
    }
179941
def del_svc_comment(self, comment_id):
        
        for svc in self.daemon.services:
            if comment_id in svc.comments:
                svc.del_comment(comment_id)
                self.send_an_element(svc.get_update_status_brok())
                break
        else:
            self.send_an_element(make_monitoring_log(
                'warning', 'DEL_SVC_COMMENT: comment id: %s does not exist '
                           'and cannot be deleted.' % comment_id))
526819
public function unpublish($comment)
    {
        $qry = new InvokePostMethodQuery($this->getResourcePath(), "unpublish", array(
            "comment" => $comment
        ));
        $this->getContext()->addQuery($qry);
    }
743264
def deleteComment(self, commentId):
        
        url = "%s/comments/%s/delete" % (self.root, commentId)
        params = {
            "f": "json",
        }
        return self._post(url,
                             params,
                             securityHandler=self._securityHandler,
                             proxy_port=self._proxy_port,
                             proxy_url=self._proxy_url)
878284
def clear_commentarea_cache(comment):
    
    parent = comment.content_object
    for instance in CommentsAreaItem.objects.parent(parent):
        instance.clear_cache()
1058855
protected function registerComment()
    {
        $this->app->singleton('jlourenco.comments.comment', function ($app) {
            $baseConfig = $app['config']->get('jlourenco.base');
            $config = $app['config']->get('jlourenco.comments');

            $model = array_get($config, 'models.comment');
            $users = array_get($baseConfig, 'models.User');

            if (class_exists($model) && method_exists($model, 'setUsersModel'))
                forward_static_call_array([$model, 'setUsersModel'], [$users]);

            return new CommentRepository($model);
        });
    }
675807
private function empty_comments() {
		global $wpdb;

		// Empty comments and comment cache
		$comment_ids = $wpdb->get_col( "SELECT comment_ID FROM $wpdb->comments" );
		foreach ( $comment_ids as $comment_id ) {
			wp_cache_delete( $comment_id, 'comment' );
			wp_cache_delete( $comment_id, 'comment_meta' );
		}
		$wpdb->query( "TRUNCATE $wpdb->comments" );
		$wpdb->query( "TRUNCATE $wpdb->commentmeta" );
	}
219640
public function delete(): void
    {
        $oUri       = Factory::service('Uri');
        $oSession   = Factory::service('Session', 'nails/module-auth');
        $oItemModel = Factory::model(
            $this->aConfig['MODEL_NAME'],
            $this->aConfig['MODEL_PROVIDER']
        );
        $iItemId    = (int) $oUri->segment(5);
        $oItem      = $oItemModel->getById($iItemId);

        if (empty($oItem)) {
            show404();
        } elseif ($oItem->id === activeUser('group_id')) {
            $oSession->setFlashData('error', 'You cannot delete your own user group.');
            redirect('admin/auth/groups');
        } elseif (!isSuperuser() && groupHasPermission('admin:superuser', $oItem)) {
            $oSession->setFlashData('error', 'You cannot delete a group which has super user permissions.');
            redirect('admin/auth/groups');
        } elseif ($oItem->id === $oItemModel->getDefaultGroupId()) {
            $oSession->setFlashData('error', 'You cannot delete the default user group.');
            redirect('admin/auth/groups');
        } else {
            parent::delete();
        }
    }
543351
public function create(Comment &$comment)
    {
        $data = $comment->exportData();
        $endpoint = '/admin/comments.json';
        $respoinse = $this->request(
            $endpoint, 'POST', array(
            'comment' => $data
            )
        );
        $comment->setData($response['comment']);
    }
1081882
public function delete_comment($commentid) {
        global $DB;
        if ($DB->record_exists('comments', array('id' => $commentid))) {
            $DB->delete_records('comments', array('id' => $commentid));
            return true;
        }
        return false;
    }
81421
public function ConfirmCommentDeletes($DiscussionID = '') {
      $Session = Gdn::Session();
      $this->Form = new Gdn_Form();
      $DiscussionModel = new DiscussionModel();
      $Discussion = $DiscussionModel->GetID($DiscussionID);
      if (!$Discussion)
         return;
      
      // Verify that the user has permission to perform the delete
      $PermissionCategory = CategoryModel::Categories($Discussion->CategoryID);
      $this->Permission('Vanilla.Comments.Delete', TRUE, 'Category', GetValue('PermissionCategoryID', $PermissionCategory));
      $this->Title(T('Confirm'));
      
      $CheckedComments = Gdn::UserModel()->GetAttribute($Session->User->UserID, 'CheckedComments', array());
      if (!is_array($CheckedComments))
         $CheckedComments = array();
       
      $CommentIDs = array();
      $DiscussionIDs = array();
      foreach ($CheckedComments as $DiscID => $Comments) {
         foreach ($Comments as $Comment) {
            if (substr($Comment, 0, 11) == 'Discussion_')
               $DiscussionIDs[] = str_replace('Discussion_', '', $Comment);
            else if ($DiscID == $DiscussionID)
               $CommentIDs[] = str_replace('Comment_', '', $Comment);
         }
      }
      $CountCheckedComments = count($CommentIDs);  
      $this->SetData('CountCheckedComments', $CountCheckedComments);
      
      if ($this->Form->AuthenticatedPostBack()) {
         // Delete the selected comments
         $CommentModel = new CommentModel();
         foreach ($CommentIDs as $CommentID) {
            $CommentModel->Delete($CommentID);
         }

         // Clear selections
         unset($CheckedComments[$DiscussionID]);
         Gdn::UserModel()->SaveAttribute($Session->UserID, 'CheckedComments', $CheckedComments);
         ModerationController::InformCheckedComments($this);
         $this->RedirectUrl = 'discussions';
      }
      
      $this->Render();
   }
527870
public function delete()
    {
        $oRemark = oxNew(\OxidEsales\Eshop\Application\Model\Remark::class);
        $oRemark->delete(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("rem_oxid"));
    }
149426
public function removeComments()
    {
        preg_match_all('/{#\s*(.+?)\s*#}(\r?\n)?/s', $this->prepared, $matches);

        if(isset($matches[0]) && is_array($matches[0]))
        {
            $this->prepared = str_replace($matches[0], '', $this->prepared);
        }
    }
567823
public function delete() {
		$this->RenderedContent = '';
		if ($this->checkPerm('Delete')) {
			$this->Tags()->removeAll();
			// if we have replies, we can't delete completely!
			if ($this->config()->soft_delete || ($this->Replies()->exists() && $this->Replies()->count() > 0)) {
				$count = $this->Replies()->count();
				$item = $this->Replies()->first();
				$this->Deleted = true;
                $this->OriginalContent = $this->Author . "\n\n" . $this->Content;
				$this->Content = _t('MicroPost.DELETED', '[deleted]');
				$this->Author = $this->Content;
				$this->write();
			} else {
                return parent::delete();
			}
		}
	}
266929
public function deleteComment($owner, $repo, $number)
	{
		$data = array();
		
		return $this->client->request("/repos/$owner/$repo/pulls/comments/$number", 'DELETE', json_encode($data), 204, '');
	}
722254
def deleteComment(self, repo_user, repo_name, comment_id):
        
        return self.api.makeRequest(
            ["repos", repo_user, repo_name,
             "pulls", "comments", str(comment_id)],
            method="DELETE")