| Versionen | |
|---|---|
| drupal6 – drupal7 | comment_unpublish_by_keyword_action($comment, $context) |
Action to unpublish a comment if it contains a certain string.
$comment A comment object.
$context An array providing more information about the context of the call to this action. Unused here, since this action currently only supports the insert and update ops of the comment hook, both of which provide a complete $comment object.
comment_unpublish_by_keyword_action_form()
comment_unpublish_by_keyword_action_submit()
modules/
<?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) {
db_query('UPDATE {comments} SET status = %d WHERE cid = %d', COMMENT_NOT_PUBLISHED, $comment->cid);
watchdog('action', 'Unpublished comment %subject.', array('%subject' => $comment->subject));
break;
}
}
}
?>
Kommentare
Kommentar hinzufügen