Add get_users_of_blog()

git-svn-id: http://svn.automattic.com/wordpress/trunk@4852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-02-01 01:19:36 +00:00
parent e71e25d354
commit 73a225e4e6
1 changed files with 10 additions and 0 deletions

View File

@ -50,6 +50,16 @@ function update_user_option( $user_id, $option_name, $newvalue, $global = false
return update_usermeta( $user_id, $option_name, $newvalue ); 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 // User meta functions
// //