Skip to Content

Can non-admin users delete comments?

Categories:

I just checked our access control settings, and it did not appear that I can grant a non-admin user the privilege to delete comments. (I want to allow members of our staff to delete spam comments).

Which privilege, if any, corresponds to the ability to delete a comment? (As admin, I get a delete link on the page where the comment appears - this is how I routinely access and delete inappropriate comments). (We are using 4.6 and our spam comments are not at an unmanageable level yet).

Thanks.

Comments

"administer comments"

Richard Eriksson's picture

The "administer comments" permission is required to delete comments.

Another Comment Question

Is there an accessible archive of comments? (e.g. acme.com/comments)

We are getting more comments and it would be great to have a permanent link to an archive-well of some kind that shows past comments.

Thanks.

Comments Page

Richard Eriksson's picture
There's probably a better way (in fact, there will be a better way, once >a href="http://drupal.org/node/75746">comment support gets added to the Views module), but here's some code I whipped up. It would go in a page, with the input format set to PHP code:
<pre>
&lt;?php
  $nlimit = 100;
  $result = db_query("SELECT c.*
  FROM comments c WHERE c.status = 0
  ORDER  BY c.timestamp DESC LIMIT %d", $nlimit);
  while ($comment = db_fetch_object($result)) {
      $nresult = db_query("SELECT n.nid, n.title FROM node n WHERE n.nid = %d", $comment-&gt;nid);
      $node = db_fetch_object($nresult);
      $output .= '&lt;h4&gt; Comment posted to "' . l($node-&gt;title, 'node/' . $node-&gt;nid) . '"&lt;/h4&gt;';
      $comment = drupal_unpack($comment);
      $comment-&gt;name = $comment-&gt;uid ? $comment-&gt;registered_name : $comment-&gt;name;
    $output .= theme('comment_view', $comment);
  }
  print $output;
?&gt;
</pre>
Be sure to set it so that the page does not display on the front page, otherwise if there is an error in the PHP code, your site will stop working. I tested it, if only briefly, in 4.6 and 4.7.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.