bb_get_latest_forum_posts

The BuddyPress bb get latest forum posts function.

Description

bb_get_latest_forum_posts( $forum_id, (int) $limit = 0, (int) $page = 1 ); 

Parameters (3)

0. $forum_id
The forum id.
1. $limit — Optional. (int)
The limit.
2. $page — Optional. (int) => 1
The page.

Usage

  1. if ( !function_exists( 'bb_get_latest_forum_posts' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-posts.php'; 
  3.  
  4. // The forum id. 
  5. $forum_id = null; 
  6.  
  7. // The limit. 
  8. $limit = -1; 
  9.  
  10. // The page. 
  11. $page = 1; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bb_get_latest_forum_posts($forum_id, $limit, $page); 
  15.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-posts.php  
  1. function bb_get_latest_forum_posts( $forum_id, $limit = 0, $page = 1 ) { 
  2. $forum_id = (int) $forum_id; 
  3. $limit = (int) $limit; 
  4. $post_query = new BB_Query( 'post', array( 'forum_id' => $forum_id, 'page' => $page, 'per_page' => $limit ), 'get_latest_forum_posts' ); 
  5. return $post_query->results;