function comment_publish_action

cis7 comment.module comment_publish_action($comment, $context = array())
cle7 comment.module comment_publish_action($comment, $context = array())
elmsmedia7 comment.module comment_publish_action($comment, $context = array())
icor7 comment.module comment_publish_action($comment, $context = array())
meedjum_blog7 comment.module comment_publish_action($comment, $context = array())
mooc7 comment.module comment_publish_action($comment, $context = array())

Publishes a comment.

Parameters

$comment: An optional comment object.

array $context: Array with components:

  • 'cid': Comment ID. Required if $comment is not given.

Related topics

7 string references to 'comment_publish_action'
comment_action_info in modules/comment/comment.module
Implements hook_action_info().
drupal-6.filled.database.php in modules/simpletest/tests/upgrade/drupal-6.filled.database.php
Filled installation of Drupal 6.17, for test purposes.
drupal-6.og-ui.database.php in sites/all/modules/ulmus/og/og_ui/tests/drupal-6.og-ui.database.php
Filled installation of Drupal 6.17, for test purposes.
drupal-6.og.database.php in sites/all/modules/ulmus/og/tests/drupal-6.og.database.php
Filled installation of Drupal 6.17, for test purposes.
drupal-6.trigger.database.php in modules/simpletest/tests/upgrade/drupal-6.trigger.database.php
Test content for the trigger upgrade path.

... See full list

File

modules/comment/comment.module, line 2560
Enables users to comment on published content.

Code

function comment_publish_action($comment, $context = array()) {
  if (isset($comment->subject)) {
    $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));
}