comment_moderation_form

Versions
4.6
comment_moderation_form($comment)

Code

modules/comment.module, line 1523

<?php
function comment_moderation_form($comment) {
  global $comment_votes, $user, $node;
  static $votes;

  $op = $_POST['op'];

  if ((comment_user_can_moderate($node)) && $user->uid != $comment->uid && !(comment_already_moderated($user->uid, $comment->users))) {
    // comment hasn't been moderated yet:
    if (!isset($votes) && $user->roles) {
      $result = db_query('SELECT v.mid, v.vote, MAX(v.weight) AS weight, MAX(r.value) AS value FROM {moderation_votes} v INNER JOIN {moderation_roles} r ON r.mid = v.mid WHERE r.rid IN (%s) GROUP BY v.mid, v.vote ORDER BY weight', implode(', ', array_keys($user->roles)));
      $votes = array(0 => t('defer until later'));
      while ($vote = db_fetch_object($result)) {
        if ($vote->value != 0) {
          $votes[$vote->mid] = $vote->vote;
        }
      }
    }
    if (count($votes) > 1) {
      return form_select(t('Moderation'), 'moderation]['. $comment->cid, 0, $votes);
    }
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.