简体   繁体   中英

How to approve a comment in Drupal when admin is replying to that comment?

I want to auto approve a comment when an admin is replying to a particular comment. This feature is available in wordpress.

If you know how to write a module you could do that by implementing hook_comment_insert() :

function MODULE_comment_insert($comment) {
  global $user;
  //check for the administrators
  if(in_array('administrator', array_values($user->roles))) {
    $comment->status = 1; // 0 for unpublished.
    comment_save($comment);
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM