comment_unpublish_action

Definition

comment_unpublish_action($comment, $context = array())
modules/comment/comment.module, line 2048

Description

Drupal action to unpublish a comment.

Parameters

$context Keyed array. Must contain the id of the comment if $comment is not passed.

$comment An optional comment object.

Code

<?php
function comment_unpublish_action($comment, $context = array()) {
  if (isset($comment->cid)) {
    $cid = $comment->cid;
    $subject = $comment->subject;
  }
  else {
    $cid = $context['cid'];
    $subject = db_result(db_query("SELECT subject FROM {comments} WHERE cid = %d", $cid));
  }
  db_query('UPDATE {comments} SET status = %d WHERE cid = %d', COMMENT_NOT_PUBLISHED, $cid);
  watchdog('action', 'Unpublished comment %subject.', array('%subject' => $subject));
}
?>
 
 

Drupal is a registered trademark of Dries Buytaert.