bb_get_last_post
The BuddyPress bb get last post function.
Description
Parameters (2)
- 0. $topic (constant)
- The topic.
- 1. $author_cache — Optional. (bool) =>
true
- The author cache.
Usage
if ( !function_exists( 'bb_get_last_post' ) ) { require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-posts.php'; } // The topic. $topic = null; // The author cache. $author_cache = true; // NOTICE! Understand what this does before running. $result = bb_get_last_post($topic, $author_cache);
Defined (1)
The function is defined in the following location(s).
- /bp-forums/bbpress/bb-includes/functions.bb-posts.php
- function bb_get_last_post( $_topic = false, $author_cache = true ) {
- global $topic, $bb_post;
- if ( !$_topic )
- $topic_id = (int) $topic->topic_id;
- else if ( is_object($_topic) )
- $topic_id = (int) $_topic->topic_id;
- else if ( is_numeric($_topic) )
- $topic_id = (int) $_topic;
- if ( !$topic_id )
- return false;
- $_topic = get_topic( $topic_id );
- if ( $post = bb_get_post( $_topic->topic_last_post_id ) ) {
- if ( $author_cache )
- bb_post_author_cache( array($post) );
- $bb_post = $post;
- }
- return $post;
- }