function comment_unpublish_by_keyword_action

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 comment.module comment_unpublish_by_keyword_action($comment, $context)
cle7 comment.module comment_unpublish_by_keyword_action($comment, $context)
elmsmedia7 comment.module comment_unpublish_by_keyword_action($comment, $context)
icor7 comment.module comment_unpublish_by_keyword_action($comment, $context)
meedjum_blog7 comment.module comment_unpublish_by_keyword_action($comment, $context)
mooc7 comment.module comment_unpublish_by_keyword_action($comment, $context)

Unpublishes a comment if it contains certain keywords.

Parameters

$comment: Comment object to modify.

array $context: Array with components:

  • 'keywords': Keywords to look for. If the comment contains at least one of the keywords, it is unpublished.

See also

comment_unpublish_by_keyword_action_form()

comment_unpublish_by_keyword_action_submit()

Related topics

2 string references to 'comment_unpublish_by_keyword_action'
comment_action_info in modules/comment/comment.module
Implements hook_action_info().
hook_action_info in modules/system/system.api.php
Declares information about actions.

File

modules/comment/comment.module, line 2617
Enables users to comment on published content.

Code

function comment_unpublish_by_keyword_action($comment, $context) {
  foreach ($context['keywords'] as $keyword) {
    $text = drupal_render($comment);
    if (strpos($text, $keyword) !== FALSE) {
      $comment->status = COMMENT_NOT_PUBLISHED;
      watchdog('action', 'Unpublished comment %subject.', array('%subject' => $comment->subject));
      break;
    }
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.