bb_get_post

The BuddyPress bb get post function.

Description

bb_get_post( $post_id ); 

Parameters (1)

0. $post_id
The post id.

Usage

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

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-posts.php  
  1. function bb_get_post( $post_id ) { 
  2. global $bbdb; 
  3. $post_id = (int) $post_id; 
  4. if ( false === $post = wp_cache_get( $post_id, 'bb_post' ) ) { 
  5. $post = $bbdb->get_row( $bbdb->prepare( "SELECT * FROM $bbdb->posts WHERE post_id = %d", $post_id ) ); 
  6. $post = bb_append_meta( $post, 'post' ); 
  7. wp_cache_set( $post_id, $post, 'bb_post' ); 
  8. return $post;