Welcome to Geeklog, Anonymous Friday, March 29 2024 @ 11:14 am EDT

Geeklog Forums

How to delete comments with a plugin


Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
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:
Text 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
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
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
 Quote

Status: offline

::Ben

Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
Dirk, thank you for reminding me the lib-comment.php file Smile
Everything I need is within.

Ben
I'm available to customise your themes or plugins for your Geeklog CMS
 Quote

All times are EDT. The time is now 11:14 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content