Révision 6ff32cea
Ajouté par Florent Torregrosa il y a environ 9 ans
drupal7/modules/comment/comment.module | ||
---|---|---|
2607 | 2607 |
/** |
2608 | 2608 |
* Unpublishes a comment if it contains certain keywords. |
2609 | 2609 |
* |
2610 |
* @param $comment |
|
2610 |
* @param object $comment
|
|
2611 | 2611 |
* Comment object to modify. |
2612 | 2612 |
* @param array $context |
2613 | 2613 |
* Array with components: |
... | ... | |
2619 | 2619 |
* @see comment_unpublish_by_keyword_action_submit() |
2620 | 2620 |
*/ |
2621 | 2621 |
function comment_unpublish_by_keyword_action($comment, $context) { |
2622 |
$node = node_load($comment->nid); |
|
2623 |
$build = comment_view($comment, $node); |
|
2624 |
$text = drupal_render($build); |
|
2622 | 2625 |
foreach ($context['keywords'] as $keyword) { |
2623 |
$text = drupal_render($comment); |
|
2624 | 2626 |
if (strpos($text, $keyword) !== FALSE) { |
2625 | 2627 |
$comment->status = COMMENT_NOT_PUBLISHED; |
2628 |
comment_save($comment); |
|
2626 | 2629 |
watchdog('action', 'Unpublished comment %subject.', array('%subject' => $comment->subject)); |
2627 | 2630 |
break; |
2628 | 2631 |
} |
Formats disponibles : Unified diff
Update core to 7.36