For example, if I am posting a comment, how can I delete it?
How delete links should be given?


On Drupal 6, users with the permission of administer comments and create comments are able to delete comments. The code that adds the delete link for comments is contained in comment_links().

  if (node_comment_mode($comment->nid) == COMMENT_NODE_READ_WRITE) {
    if (user_access('administer comments') && user_access('post comments')) {
      $links['comment_delete'] = array(
        'title' => t('delete'), 
        'href' => "comment/delete/$comment->cid",
      $links['comment_edit'] = array(
        'title' => t('edit'), 
        'href' => "comment/edit/$comment->cid",
      $links['comment_reply'] = array(
        'title' => t('reply'), 
        'href' => "comment/reply/$comment->nid/$comment->cid",

Similar code is present in Drupal 7 and higher.

Third-party modules allows other users to delete comments.

  • Comment Delete allows the comment authors to delete the comment they created. The module is for Drupal 6.
  • User tweaks, a module I maintain, allows the comment's authors to delete their own comments; it also allows users to delete any comment, or any comment associated with nodes of specific content types. In both the cases, the user needs an additional permission, but not the permission to administer comments. The module is for Drupal 7.

I found a module Comment Delete that will help to allow comment authors to delete there own comments.

It is available for version 6


For allowing users to delete their own comments in D7, here are a few threads with discussion and example code:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.