diff --git a/wp-includes/user.php b/wp-includes/user.php index c7e9e586e5..99e6ee1a60 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -50,6 +50,16 @@ function update_user_option( $user_id, $option_name, $newvalue, $global = false return update_usermeta( $user_id, $option_name, $newvalue ); } +// Get users with capabilities for the current blog. +// For setups that use the multi-blog feature. +function get_users_of_blog( $id = '' ) { + global $wpdb, $blog_id; + if ( empty($id) ) + $id = $blog_id; + $users = $wpdb->get_results( "SELECT user_id, user_login, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE " . $wpdb->users . ".ID = " . $wpdb->usermeta . ".user_id AND meta_key = '" . $wpdb->table_prefix . "_capabilities' ORDER BY {$wpdb->usermeta}.user_id" ); + return $users; +} + // // User meta functions //