wpcf7_akismet_comment_check

The Contact Form 7 wpcf7 akismet comment check function.

Description

wpcf7_akismet_comment_check( $comment ); 

Parameters (1)

0. $comment
The comment.

Usage

  1. if ( !function_exists( 'wpcf7_akismet_comment_check' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/modules/akismet.php'; 
  3.  
  4. // The comment. 
  5. $comment = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpcf7_akismet_comment_check($comment); 
  9.  

Defined (1)

The function is defined in the following location(s).

/modules/akismet.php  
  1. function wpcf7_akismet_comment_check( $comment ) { 
  2. global $akismet_api_host, $akismet_api_port; 
  3.  
  4. $spam = false; 
  5. $query_string = wpcf7_build_query( $comment ); 
  6.  
  7. if ( is_callable( array( 'Akismet', 'http_post' ) ) ) { // Akismet v3.0+ 
  8. $response = Akismet::http_post( $query_string, 'comment-check' ); 
  9. } else { 
  10. $response = akismet_http_post( $query_string, $akismet_api_host,  
  11. '/1.1/comment-check', $akismet_api_port ); 
  12.  
  13. if ( 'true' == $response[1] ) { 
  14. $spam = true; 
  15.  
  16. if ( $submission = WPCF7_Submission::get_instance() ) { 
  17. $submission->akismet = array( 'comment' => $comment, 'spam' => $spam ); 
  18.  
  19. return apply_filters( 'wpcf7_akismet_comment_check', $spam, $comment );