Re: Change Post Order Question
The easy way is to find get_thread( $topic_id, $page )
in /topic.php
and change it to get_thread( $topic_id, $page, true )
.
The better way is to use a plugin so that you aren’t modifying any core files. (This is untested)
<?php
/*
Plugin Name: Reverse Post Order
Plugin URI: https://bbpress.org/forums/topic/76
*/
function reverse_post_order() {
global $topic_id, $page, $topic, $bb_current_user;
global $bb_db_override, $posts, $forum, $tags, $user_tags, $other_tags, $list_start;
$bb_db_override = true;
$posts = get_thread( $topic_id, $page );
$forum = get_forum ( $topic->forum_id );
$tags = get_topic_tags ( $topic_id );
if ( $bb_current_user && $tags ) {
$user_tags = get_user_tags ( $topic_id, $bb_current_user->ID );
$other_tags = get_other_tags ( $topic_id, $bb_current_user->ID );
} elseif ( is_array($tags) ) {
$user_tags = false;
$other_tags = get_public_tags( $topic_id );
} else {
$user_tags = false;
$other_tags = false;
}
$list_start = ($page – 1) * bb_get_option(‘page_topics’) + 1;
post_author_cache($posts);
}
add_action( ‘bb_topic.php_pre_db’, ‘reverse_post_order’ );
?>