Do you have some feature in mind that you'd love to see in Couch? Let us know.
2 posts Page 1 of 1
I have searched the forum and could not find a way to do this.

Is there a way to delete or edit comments left by registered users? I am using the extended-comments module as well.

I can make it such that the extended-comments page gets deleted but the initial comment will not get removed with it. Is there a way to automate that ?
I have managed to create a delete-comments.php file which makes use of the K_TBL_COMMENTS to delete a comment based on it's ID:

Code: Select all



    if (isset($_POST['commentId'])) {
        $commentId = trim($_POST['commentId']);

        if (isset($DB)) {
            $commentId = $DB->sanitize($commentId);

            $rs = $DB->delete(K_TBL_COMMENTS, "id='" . $commentId . "'");
            if ($rs == -1) {
                error_log('Error: Unable to delete comment from K_TBL_COMMENTS');
                echo json_encode(['error' => 'Unable to delete comment']);
            } else {
                error_log('Comment deleted successfully');
                echo json_encode(['success' => true]);
        } else {
            echo json_encode(['error' => 'Database connection not available']);

    } else {
        echo json_encode(['error' => 'Comment ID not provided']);

} else {
    echo json_encode(['error' => 'Invalid request method']);


And while this does work with an AJAX request using POST and passing the comment ID on click using a javascript function, I can not help but wonder if there is a better way.
2 posts Page 1 of 1