bbp_update_forum_last_active_time

Update the forums last active date/time (aka freshness).

Description

bbp_update_forum_last_active_time( (int) $forum_id = 0, (string) $new_time = '' ); 

Parameters (2)

0. $forum_id — Optional. (int)
Topic id
1. $new_time — Optional. (string) => ''
New time in mysql format

Usage

  1. if ( !function_exists( 'bbp_update_forum_last_active_time' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/forums/functions.php'; 
  3.  
  4. // Optional. Topic id 
  5. $forum_id = -1; 
  6.  
  7. // Optional. New time in mysql format 
  8. $new_time = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bbp_update_forum_last_active_time($forum_id, $new_time); 
  12.  

Defined (1)

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

/includes/forums/functions.php  
  1. function bbp_update_forum_last_active_time( $forum_id = 0, $new_time = '' ) { 
  2. $forum_id = bbp_get_forum_id( $forum_id ); 
  3.  
  4. // Check time and use current if empty 
  5. if ( empty( $new_time ) ) 
  6. $new_time = get_post_field( 'post_date', bbp_get_forum_last_active_id( $forum_id ) ); 
  7.  
  8. // Update only if there is a time 
  9. if ( !empty( $new_time ) ) 
  10. update_post_meta( $forum_id, '_bbp_last_active_time', $new_time ); 
  11.  
  12. return (int) apply_filters( 'bbp_update_forum_last_active', $new_time, $forum_id );