bbp_get_forum_last_active_time

Return the forums last update date/time (aka freshness).

Description

(string) bbp_get_forum_last_active_time( (int) $forum_id = 0 ); 

Returns (string)

Forum last update date/time (freshness)

Parameters (1)

0. $forum_id — Optional. (int)
Forum id

Usage

  1. if ( !function_exists( 'bbp_get_forum_last_active_time' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/forums/template.php'; 
  3.  
  4. // Optional. Forum id 
  5. $forum_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_get_forum_last_active_time($forum_id); 
  9.  

Defined (1)

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

/includes/forums/template.php  
  1. function bbp_get_forum_last_active_time( $forum_id = 0 ) { 
  2.  
  3. // Verify forum and get last active meta 
  4. $forum_id = bbp_get_forum_id( $forum_id ); 
  5. $last_active = get_post_meta( $forum_id, '_bbp_last_active_time', true ); 
  6.  
  7. if ( empty( $last_active ) ) { 
  8. $reply_id = bbp_get_forum_last_reply_id( $forum_id ); 
  9. if ( !empty( $reply_id ) ) { 
  10. $last_active = get_post_field( 'post_date', $reply_id ); 
  11. } else { 
  12. $topic_id = bbp_get_forum_last_topic_id( $forum_id ); 
  13. if ( !empty( $topic_id ) ) { 
  14. $last_active = bbp_get_topic_last_active_time( $topic_id ); 
  15.  
  16. $active_time = !empty( $last_active ) ? bbp_get_time_since( bbp_convert_date( $last_active ) ) : ''; 
  17.  
  18. return apply_filters( 'bbp_get_forum_last_active', $active_time, $forum_id );