Skip to:
Content

BuddyPress.org

Ticket #6012: 6012.01.patch

File 6012.01.patch, 2.1 KB (added by r-a-y, 9 years ago)
  • src/bp-blogs/bp-blogs-functions.php

     
    12101210 * @return int $count Total blog count.
    12111211 */
    12121212function bp_blogs_total_blogs() {
    1213         if ( !$count = wp_cache_get( 'bp_total_blogs', 'bp' ) ) {
     1213        $count = wp_cache_get( 'bp_total_blogs', 'bp' );
     1214
     1215        if ( false === $count ) {
    12141216                $blogs = BP_Blogs_Blog::get_all();
    12151217                $count = $blogs['total'];
    12161218                wp_cache_set( 'bp_total_blogs', $count, 'bp' );
  • src/bp-groups/bp-groups-functions.php

     
    633633 * @return int
    634634 */
    635635function groups_get_total_group_count() {
    636         if ( !$count = wp_cache_get( 'bp_total_group_count', 'bp' ) ) {
     636        $count = wp_cache_get( 'bp_total_group_count', 'bp' );
     637
     638        if ( false === $count ) {
    637639                $count = BP_Groups_Group::get_total_group_count();
    638640                wp_cache_set( 'bp_total_group_count', $count, 'bp' );
    639641        }
     
    673675        if ( empty( $user_id ) )
    674676                $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
    675677
    676         if ( !$count = wp_cache_get( 'bp_total_groups_for_user_' . $user_id, 'bp' ) ) {
     678        $count = wp_cache_get( 'bp_total_groups_for_user_' . $user_id, 'bp' );
     679
     680        if ( false === $count ) {
    677681                $count = BP_Groups_Member::total_group_count( $user_id );
    678682                wp_cache_set( 'bp_total_groups_for_user_' . $user_id, $count, 'bp' );
    679683        }
  • src/bp-members/bp-members-functions.php

     
    597597function bp_core_get_total_member_count() {
    598598        global $wpdb;
    599599
    600         if ( !$count = wp_cache_get( 'bp_total_member_count', 'bp' ) ) {
     600        $count = wp_cache_get( 'bp_total_member_count', 'bp' );
     601
     602        if ( false === $count ) {
    601603                $status_sql = bp_core_get_status_sql();
    602604                $count = $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->users} WHERE {$status_sql}" );
    603605                wp_cache_set( 'bp_total_member_count', $count, 'bp' );