Subject: How to delete comments with a plugin

Posted on: 04/07/2013 12:51pm
By: ::Ben

I'm working on a monitor plugin upgrade and I want to allow admins to edit (silently) or delete any comment. Basicaly, it is a complete list of all the comment.

I delete comments with:
PHP Formatted Code

$sql = "DELETE FROM {$_TABLES['comments']} "
                 . "WHERE cid = '{$cid}'";
DB_query ($sql);
 


but I wonder if there is a best way, a cleanest way, an api... to take care of sub-comment, comment feed, etc... ?

Ben

Re: How to delete comments with a plugin

Posted on: 04/07/2013 05:08pm
By: Dirk

Please don't delete comments directly. The comments are kept in a tree structure for faster access and that tree needs to be re-balanced when a comment is removed.

Use CMT_deleteComment() from system/lib-comment.php

bye, Dirk

Re: How to delete comments with a plugin

Posted on: 05/07/2013 03:57am
By: ::Ben

Dirk, thank you for reminding me the lib-comment.php file Smile
Everything I need is within.

Ben

Geeklog - Forum
https://www.geeklog.net/forum/viewtopic.php?showtopic=95109