comment_unpublish_by_keyword_action

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 – drupal7 comment_unpublish_by_keyword_action($comment, $context)

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

Übergabeparameter

$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.

See also

comment_unpublish_by_keyword_action_form()

comment_unpublish_by_keyword_action_submit()

Verwandte Themen

Code

modules/comment/comment.module, line 2123

<?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

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen