function comment_unpublish_action
Same name and namespace in other branches
- 6.x drupal-6.x/modules/comment/comment.module \comment_unpublish_action()
Unpublishes a comment.
Parameters
$comment: An optional comment object.
array $context: Array with components:
- 'cid': Comment ID. Required if $comment is not given.
Related topics
1 call to comment_unpublish_action()
- CommentActionsTestCase::testCommentPublishUnpublishActions in drupal-7.x/
modules/ comment/ comment.test - Test comment publish and unpublish actions.
3 string references to 'comment_unpublish_action'
- comment_action_info in drupal-7.x/
modules/ comment/ comment.module - Implements hook_action_info().
- drupal-6.filled.database.php in drupal-7.x/
modules/ simpletest/ tests/ upgrade/ drupal-6.filled.database.php - Filled installation of Drupal 6.17, for test purposes.
- hook_action_info in drupal-7.x/
modules/ system/ system.api.php - Declares information about actions.
Archivo
- drupal-7.x/
modules/ comment/ comment.module, line 2587 - Enables users to comment on published content.
Código
function comment_unpublish_action($comment, $context = array()) {
if (isset($comment->subject)) {
$subject = $comment->subject;
$comment->status = COMMENT_NOT_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_NOT_PUBLISHED))->condition('cid', $cid)->execute();
}
watchdog('action', 'Unpublished comment %subject.', array('%subject' => $subject));
}