Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: limit forums included in latest discussions


deadlyhifi
Participant

@tomdebruin

you can do this with a plugin if you like.

function filter_front_page_topics($where){
$exclude_forums=array ("3"); // enable this to manually specify specific forums by id #
if ( is_front() ) {foreach($exclude_forums as $forum) { $where.=" AND forum_id != ".$forum." "; }}
return $where;
}
add_filter( 'get_latest_topics_where', 'filter_front_page_topics');
add_filter( 'get_latest_posts_where', 'filter_front_page_topics');

If you have front page paging (1,2,3,4 etc) then the paging count will be wrong. You need to edit the bb-includes/function.bb-template.php file

function bb_latest_topics_pages() {
global $page;
static $bb_latest_topics_count;
if (!$bb_latest_topics_count) {
global $bbdb;
$bb_latest_topics_count = $bbdb->get_var('SELECT COUNT(<code>topic_id</code>) FROM <code>' . $bbdb->topics . '</code> WHERE <code>topic_open</code> = 1 AND <code>topic_status</code> = 0 AND <code>topic_sticky</code> != 2 AND <code>forum_id</code> != 3;');
}
echo apply_filters( 'bb_latest_topics_pages', get_page_number_links( $page, $bb_latest_topics_count ), $bb_latest_topics_count );
}

Note the addition of AND "forum_id" != 3 to the query.

EDIT: just noticed that use of backticks in the code has been turned into <code>, so amend as necessary.

Skip to toolbar