Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当管理员回复Drupal中的评论时,如何批准该评论?_Drupal_Drupal 7_Drupal Comments - Fatal编程技术网

当管理员回复Drupal中的评论时,如何批准该评论?

当管理员回复Drupal中的评论时,如何批准该评论?,drupal,drupal-7,drupal-comments,Drupal,Drupal 7,Drupal Comments,我想在管理员回复特定评论时自动批准评论。此功能在wordpress中提供 如果您知道如何编写模块,您可以通过实现: function MODULE_comment_insert($comment) { global $user; //check for the administrators if(in_array('administrator', array_values($user->roles))) { $comment->status = 1; // 0 f

我想在管理员回复特定评论时自动批准评论。此功能在wordpress中提供

如果您知道如何编写模块,您可以通过实现:

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);
  }
}