grunion_recheck_queue

Recheck all approved feedbacks for spam.

Description

grunion_recheck_queue(); 

Usage

  1. if ( !function_exists( 'grunion_recheck_queue' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/contact-form/admin.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = grunion_recheck_queue(); 
  7.  

Defined (1)

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

/modules/contact-form/admin.php  
  1. function grunion_recheck_queue() { 
  2. global $wpdb; 
  3.  
  4. $query = 'post_type=feedback&post_status=publish'; 
  5.  
  6. if ( isset( $_POST['limit'], $_POST['offset'] ) ) { 
  7. $query .= '&posts_per_page=' . intval( $_POST['limit'] ) . '&offset=' . intval( $_POST['offset'] ); 
  8.  
  9. $approved_feedbacks = get_posts( $query ); 
  10.  
  11. foreach ( $approved_feedbacks as $feedback ) { 
  12. $meta = get_post_meta( $feedback->ID, '_feedback_akismet_values', true ); 
  13.  
  14. /** 
  15. * Filter whether the submitted feedback is considered as spam. 
  16. * @module contact-form 
  17. * @since 3.4.0 
  18. * @param bool false Is the submitted feedback spam? Default to false. 
  19. * @param array $meta Feedack values returned by the Akismet plugin. 
  20. */ 
  21. $is_spam = apply_filters( 'jetpack_contact_form_is_spam', false, $meta ); 
  22.  
  23. if ( $is_spam ) { 
  24. wp_update_post( array( 'ID' => $feedback->ID, 'post_status' => 'spam' ) ); 
  25. /** This action is already documented in modules/contact-form/admin.php */ 
  26. do_action( 'contact_form_akismet', 'spam', $akismet_values ); 
  27.  
  28. wp_send_json( array( 
  29. 'processed' => count( $approved_feedbacks ),  
  30. ) );