Changeset 8599
- Timestamp:
- 07/11/2014 09:25:08 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/bp-blogs-functions.php
r8598 r8599 74 74 * Populate the BP blogs table with existing blogs. 75 75 * 76 * @global object $bp BuddyPress global settings 76 * @since BuddyPress (1.0.0) 77 * 77 78 * @global object $wpdb WordPress database object 78 79 * @uses get_users() … … 80 81 */ 81 82 function bp_blogs_record_existing_blogs() { 82 global $ bp, $wpdb;83 global $wpdb; 83 84 84 85 // Query for all sites in network … … 109 110 } 110 111 112 // Get BuddyPress 113 $bp = buddypress(); 114 111 115 // Truncate user blogs table 112 116 $truncate = $wpdb->query( "TRUNCATE {$bp->blogs->table_name}" ); … … 128 132 129 133 // Get all users 130 $all_users = get_users( array( 131 'blog_id' => $blog_id, 132 'fields' => 'ID' 134 $users = get_users( array( 135 'blog_id' => $blog_id 133 136 ) ); 134 135 // Get subscribers136 $subscribers = get_users( array(137 'blog_id' => $blog_id,138 'fields' => 'ID',139 'role' => 'subscriber'140 ) );141 142 // Remove subscribers from users (for some legacy/wpcom reason?)143 $users = array_values( array_diff( $all_users, $subscribers ) );144 145 // Reclaim some memory in the event there are many users146 unset( $all_users, $subscribers );147 137 148 138 // Continue on if no users exist for this site (how did this happen?) … … 153 143 // Loop through users and record their relationship to this blog 154 144 foreach ( (array) $users as $user ) { 155 bp_blogs_ record_blog( $blog_id, $user, true);145 bp_blogs_add_user_to_blog( $user->ID, false, $blog_id ); 156 146 } 157 147 }
Note: See TracChangeset
for help on using the changeset viewer.