comment_unpublish_by_keyword_action
modules/comment/comment.module, строка 2100
- Версии
- 6
comment_unpublish_by_keyword_action($comment, $context)
Implementation of a configurable Drupal action. Unpublish a comment if it contains a certain string.
Параметры
$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
A comment object.
Код
<?php
function comment_unpublish_by_keyword_action($comment, $context) {
foreach ($context['keywords'] as $keyword) {
if (strstr($comment->comment, $keyword) || strstr($comment->subject, $keyword)) {
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;
}
}
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии