Skip to:
Content

BuddyPress.org

Changeset 6930


Ignore:
Timestamp:
04/19/2013 09:11:47 PM (13 years ago)
Author:
boonebgorges
Message:

Don't query for entire user objects in bp_blogs_record_existing_blogs()

When recording existing blogs, we only need user ids of blog members. So it's
only necessary to query for the ID field when using get_users(). This should
result in significant performance enhancements on large installations.

Fixes #4856

Props borkweb

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs/bp-blogs-functions.php

    r6929 r6930  
    5757        if ( !empty( $blog_ids ) ) {
    5858                foreach( (array) $blog_ids as $blog_id ) {
    59                         $users       = get_users( array( 'blog_id' => $blog_id ) );
    60                         $subscribers = get_users( array( 'blog_id' => $blog_id, 'role' => 'subscriber' ) );
     59                        $users       = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ID' ) );
     60                        $subscribers = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ID', 'role' => 'subscriber' ) );
    6161
    6262                        if ( !empty( $users ) ) {
     
    6464                                        // Don't record blogs for subscribers
    6565                                        if ( !in_array( $user, $subscribers ) ) {
    66                                                 bp_blogs_record_blog( $blog_id, $user->ID, true );
     66                                                bp_blogs_record_blog( $blog_id, $user, true );
    6767                                        }
    6868                                }
Note: See TracChangeset for help on using the changeset viewer.