WordPress has a useful option for comment moderation in its Discussion Settings panel called "Before a comment appears: Comment author must have a previously approved comment".


How can one configure Drupal to approve future comments if a user has a previously approved comment in the site?

This is a follow-up from an unresolved post on Drupal.org: Auto-publish comments after that anonymous user’s previous comments have been approved [X] number of times


You need to create a small custom module. In D6 you override hook_comment:

function MYMODULE_comment(&$comment, $op) {
    if ($op=='insert' && !$comment['uid'] && $comment['status']==COMMENT_NOT_PUBLISHED){ //only perform on operating  insert for new comments and if the user is anonymous
        // query database for a previously approved comment by this email
       $has_published=db_result(db_query("SELECT cid FROM {comments} WHERE status=%d AND mail='%s'", COMMENT_PUBLISHED, $comment['mail']));  
       if ($has_published){
          db_query("UPDATE {comments} SET status=%d WHERE cid=%d",COMMENT_PUBLISHED,$comment['cid']); //set the current comment to unpublished
          $comment['status']=COMMENT_PUBLISHED; //return with a status of not published so the user is notified that their comment is  awaiting approval

It should be easy to convert this to D7 using hook_comment_insert.

The solution was originally suggested here.

  • Looks great! This would be a good idea for a contributed module. – Mike Eng Sep 30 '11 at 16:00
  • 1
    Would it be possible to update the answer for current Drupal 7 ? – ttoine Jun 14 '13 at 16:16

If you don't have programming skills use the Rules module.


You can use the Comment Trust module (Drupal 7 only) in order to auto-approve comments from trusted visitors.

Comment Trust auto-approves comments by users with previously-approved comments. It rewards trusted commenters with immediate approvals, while requiring you to approve the comments by new visitors. Works for both anonymous and authenticated users.

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.