bbp_past_edit_lock

Check the date against the _bbp_edit_lock setting.

Description

bbp_past_edit_lock( (string) $post_date_gmt ); 

Parameters (1)

0. $post_date_gmt (string)
The post date gmt.

Usage

  1. if ( !function_exists( 'bbp_past_edit_lock' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/common/functions.php'; 
  3.  
  4. // The post date gmt. 
  5. $post_date_gmt = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_past_edit_lock($post_date_gmt); 
  9.  

Defined (1)

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

/includes/common/functions.php  
  1. function bbp_past_edit_lock( $post_date_gmt ) { 
  2.  
  3. // Assume editing is allowed 
  4. $retval = false; 
  5.  
  6. // Bail if empty date 
  7. if ( ! empty( $post_date_gmt ) ) { 
  8.  
  9. // Period of time 
  10. $lockable = '+' . get_option( '_bbp_edit_lock', '5' ) . ' minutes'; 
  11.  
  12. // Now 
  13. $cur_time = current_time( 'timestamp', true ); 
  14.  
  15. // Add lockable time to post time 
  16. $lock_time = strtotime( $lockable, strtotime( $post_date_gmt ) ); 
  17.  
  18. // Compare 
  19. if ( $cur_time >= $lock_time ) { 
  20. $retval = true; 
  21.  
  22. return apply_filters( 'bbp_past_edit_lock', (bool) $retval, $cur_time, $lock_time, $post_date_gmt );