Skip to:
Content

bbPress.org

Ticket #1183: 1183.diff

File 1183.diff, 1.1 KB (added by mr_pelle, 14 years ago)

just added a $bb_db_override check

  • functions.bb-template.php

     
    679679        $defaults = array( 'before' => '', 'after' => '' );
    680680        $args = wp_parse_args( $args, $defaults );
    681681
    682         global $page;
    683         static $bb_latest_topics_count;
    684         if ( !$bb_latest_topics_count) {
    685                 global $bbdb;
    686                 $bb_latest_topics_count = $bbdb->get_var('SELECT COUNT(`topic_id`) FROM `' . $bbdb->topics . '` WHERE `topic_status` = 0 AND `topic_sticky` != 2;');
     682        global $page, $bb_db_override;
     683       
     684        if ( !$bb_db_override ) {
     685                static $bb_latest_topics_count;
     686
     687                if ( !$bb_latest_topics_count ) {
     688                        global $bbdb;
     689                        $bb_latest_topics_count = $bbdb->get_var('SELECT COUNT(`topic_id`) FROM `' . $bbdb->topics . '` WHERE `topic_status` = 0 AND `topic_sticky` != 2;');
     690                }
    687691        }
     692
    688693        if ( $pages = apply_filters( 'bb_latest_topics_pages', get_page_number_links( $page, $bb_latest_topics_count ), $bb_latest_topics_count ) ) {
    689694                echo $args['before'] . $pages . $args['after'];
    690695        }