Skip to:
Content

BuddyPress.org

Changeset 3660 for trunk/bp-forums.php


Ignore:
Timestamp:
01/05/2011 10:03:41 PM (14 years ago)
Author:
djpaul
Message:

Speed up forum directory's "last active" bbPress SQL query to stop it fetching information we aren't using. Helps fix #2421

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-forums.php

    r3659 r3660  
    373373    do_action( 'bbpress_init' );
    374374
    375     $count = $bbdb->get_results( $bbdb->prepare( "SELECT t.topic_id FROM {$bbdb->topics} AS t". groups_add_forum_tables_sql( '' ) . " WHERE " . groups_add_forum_where_sql( "t.topic_status = '0'" ) ) );
     375    $count = $bbdb->get_results( $bbdb->prepare( "SELECT t.topic_id FROM {$bbdb->topics} AS t". groups_add_forum_tables_sql( '' ) . " WHERE " . groups_add_forum_where_sql( "t.topic_status = 0" ) ) );
    376376    return apply_filters( 'bp_forums_total_topic_count', count( (array)$count ) );
    377377}
     
    547547}
    548548
    549 
    550549function bp_forums_get_forum_topicpost_count( $forum_id ) {
    551550    global $wpdb, $bbdb;
     
    556555    return $wpdb->get_results( $wpdb->prepare( "SELECT topics, posts from {$bbdb->forums} WHERE forum_id = %d", $forum_id ) );
    557556}
    558 
    559557
    560558function bp_forums_filter_caps( $allcaps ) {
     
    589587add_action( 'bp_forums_new_topic', 'bp_core_clear_cache' );
    590588add_action( 'bp_forums_new_post', 'bp_core_clear_cache' );
    591 
    592589?>
Note: See TracChangeset for help on using the changeset viewer.