comment_unpublish_by_keyword_action

Versions
6 – 7
comment_unpublish_by_keyword_action($comment, $context)

Action to unpublish a comment if it contains a certain string.

See also

comment_unpublish_by_keyword_action_form()

@see comment_unpublish_by_keyword_action_submit()

Parameters

$comment A 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 2372

<?php
function comment_unpublish_by_keyword_action($comment, $context) {
  foreach ($context['keywords'] as $keyword) {
    if (strpos($comment->comment, $keyword) !== FALSE || strpos($comment->subject, $keyword) !== FALSE) {
      $comment->status = COMMENT_NOT_PUBLISHED;
      watchdog('action', 'Unpublished comment %subject.', array('%subject' => $comment->subject));
      break;
    }
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.