Ticket #6940: 6940.02-single-site-check-user-count.patch
File 6940.02-single-site-check-user-count.patch, 1.2 KB (added by , 9 years ago) |
---|
-
src/bp-blogs/bp-blogs-functions.php
102 102 103 103 // Record a single site. 104 104 } else { 105 $blog_ids = $wpdb->blogid; 105 // Count users. 106 $count = count_users(); 107 $count = $count['total_users']; 108 109 /** This filter is documented in /wp-includes/ms-functions.php **/ 110 $is_large_install = apply_filters( 'wp_is_large_network', $count > 10000, 'users', $count ); 111 112 if ( $is_large_install ) { 113 $blog_ids = false; 114 } else { 115 $blog_ids = $wpdb->blogid; 116 } 106 117 } 107 118 108 119 // Bail if there are no blogs in the network. … … 133 144 134 145 // Get all users. 135 146 $users = get_users( array( 136 'blog_id' => $blog_id 147 'blog_id' => $blog_id, 148 'fields' => 'ID' 137 149 ) ); 138 150 139 151 // Continue on if no users exist for this site (how did this happen?). … … 142 154 } 143 155 144 156 // Loop through users and record their relationship to this blog. 145 foreach ( (array) $users as $user ) {146 bp_blogs_add_user_to_blog( $user ->ID, false, $blog_id );157 foreach ( (array) $users as $user_id ) { 158 bp_blogs_add_user_to_blog( $user_id, false, $blog_id ); 147 159 } 148 160 } 149 161