Skip to:
Content

BuddyPress.org

Changeset 2760


Ignore:
Timestamp:
02/22/2010 01:15:44 PM (14 years ago)
Author:
apeatling
Message:

Fixed issue where site admins would not see the correct blog count for a user as it was not including private blogs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-blogs/bp-blogs-classes.php

    r2579 r2760  
    210210
    211211        // If the user is logged in return the blog count including their hidden blogs.
    212         if ( !is_user_logged_in() || $user_id != $bp->loggedin_user->id )
     212        if ( ( is_user_logged_in() && $user_id == $bp->loggedin_user->id ) || is_site_admin() )
     213            return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND user_id = %d", $user_id) );
     214        else
    213215            return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.public = 1 AND wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND user_id = %d", $user_id) );
    214         else
    215             return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(DISTINCT b.blog_id) FROM {$bp->blogs->table_name} b LEFT JOIN {$wpdb->base_prefix}blogs wb ON b.blog_id = wb.blog_id WHERE wb.deleted = 0 AND wb.spam = 0 AND wb.mature = 0 AND wb.archived = '0' AND user_id = %d", $user_id) );
    216216    }
    217217
Note: See TracChangeset for help on using the changeset viewer.