bb_check_post_flood

Check to make sure that a user is not making too many posts in a short amount of time.

Description

bb_check_post_flood(); 

Usage

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

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-posts.php  
  1. function bb_check_post_flood() { 
  2. global $bbdb; 
  3. $user_id = (int) $user_id; 
  4. $throttle_time = bb_get_option( 'throttle_time' ); 
  5.  
  6. if ( bb_current_user_can( 'manage_options' ) || empty( $throttle_time ) ) 
  7. return; 
  8.  
  9. if ( bb_is_user_logged_in() ) { 
  10. $bb_current_user = bb_get_current_user(); 
  11.  
  12. if ( isset($bb_current_user->data->last_posted) && time() < $bb_current_user->data->last_posted + $throttle_time && ! bb_current_user_can( 'throttle' ) ) 
  13. if ( defined( 'DOING_AJAX' ) && DOING_AJAX
  14. die( __( 'Slow down; you move too fast.' ) ); 
  15. else 
  16. bb_die( __( 'Slow down; you move too fast.' ) ); 
  17. } else { 
  18. if ( ( $last_posted = bb_get_transient($_SERVER['REMOTE_ADDR'] . '_last_posted') ) && time() < $last_posted + $throttle_time ) 
  19. if ( defined('DOING_AJAX') && DOING_AJAX
  20. die( __( 'Slow down; you move too fast.' ) ); 
  21. else 
  22. bb_die( __( 'Slow down; you move too fast.' ) );