comment_publish_action
- Versions
- 7
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
Code
modules/comment/comment.module, line 2318
<?php
function comment_publish_action($comment, $context = array()) {
if (isset($comment->comment)) {
$subject = $comment->subject;
$comment->status = COMMENT_PUBLISHED;
}
else {
$cid = $context['cid'];
$subject = db_query('SELECT subject FROM {comment} WHERE cid = :cid', array(':cid', $cid))->fetchField();
db_update('comment')
->fields(array('status' => COMMENT_PUBLISHED))
->condition('cid', $cid)
->execute();
}
watchdog('action', 'Published comment %subject.', array('%subject' => $subject));
}
?>Login or register to post comments 