【问题标题】:How to approve a comment in Drupal when admin is replying to that comment?当管理员回复评论时,如何在 Drupal 中批准评论?
【发布时间】:2013-05-24 06:52:06
【问题描述】:

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

【问题讨论】:

    标签: drupal drupal-7 drupal-comments


    【解决方案1】:

    如果你知道如何编写模块,你可以通过实现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);
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-19
      • 1970-01-01
      • 1970-01-01
      • 2018-12-15
      • 1970-01-01
      相关资源
      最近更新 更多