function comment_publish_action
7.x comment.module | comment_publish_action($comment, $context = array()) |
6.x comment.module | comment_publish_action($comment, $context = array()) |
Action to publish a comment.
Parameters
$comment: An optional comment object.
$context: Keyed array. Must contain the id of the comment if $comment is not passed.
Related topics
1 string reference to 'comment_publish_action'
- comment_action_info in drupal-6.x/
modules/ comment/ comment.module - Implementation of hook_action_info().
File
- drupal-6.x/
modules/ comment/ comment.module, line 2071 - Enables users to comment on published content.
Code
function comment_publish_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_PUBLISHED, $cid);
watchdog('action', 'Published comment %subject.', array('%subject' => $subject));
}