bb_akismet_delete_old

The BuddyPress bb akismet delete old function.

Description

bb_akismet_delete_old(); 

Usage

  1. if ( !function_exists( 'bb_akismet_delete_old' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-plugins/akismet.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bb_akismet_delete_old(); 
  7.  

Defined (1)

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

/bp-forums/bbpress/bb-plugins/akismet.php  
  1. function bb_akismet_delete_old() 
  2. // Delete old every 20 
  3. $n = mt_rand( 1, 20 ); 
  4. if ( $n % 20 ) { 
  5. return; 
  6. global $bbdb; 
  7. $now = bb_current_time( 'mysql' ); 
  8. $posts = (array) $bbdb->get_col( $bbdb->prepare( 
  9. "SELECT post_id FROM $bbdb->posts WHERE DATE_SUB(%s, INTERVAL 15 DAY) > post_time AND post_status = '2'",  
  10. $now 
  11. ) ); 
  12. foreach ( $posts as $post ) { 
  13. bb_delete_post( $post, 1 );