function bb_get_first_post($_topic = false, $author_cache = true)
{
    global $topic, $bb_first_post_cache, $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;
    }
    if (isset($bb_first_post_cache[$topic_id])) {
        $post = bb_get_post($bb_first_post_cache[$topic_id]);
    } else {
        $first_posts = bb_cache_first_posts(array($topic_id), $author_cache);
        if (isset($first_posts[$topic_id])) {
            $post = $first_posts[$topic_id];
        }
    }
    if ($post) {
        $bb_post = $post;
        return $bb_post;
    }
    return false;
}
예제 #2
0
?>
</div>
<div class="clear"></div>

<?php 
if (!$topics) {
    ?>

<p class="no-results"><?php 
    _e('No topics found.');
    ?>
</p>

<?php 
} else {
    bb_cache_first_posts($topics);
    bb_cache_last_posts($topics);
    ?>

<table id="topics-list" class="widefat">
<thead>
<tr>
	<th scope="col"><?php 
    _e('Topic');
    ?>
</th>
	<th scope="col"><?php 
    _e('Author');
    ?>
</th>
	<th scope="col"><?php