Revert get_users_of_blog() to 3.0 behavior and deprecate. Use get_users() in core. Props scribu. fixes #15854

git-svn-id: http://svn.automattic.com/wordpress/trunk@17084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-12-20 16:25:35 +00:00
parent 1a5d8ccdd8
commit e8468d167a
4 changed files with 29 additions and 24 deletions

View File

@ -65,12 +65,12 @@ function wpmu_delete_blog( $blog_id, $drop = false ) {
do_action( 'delete_blog', $blog_id, $drop );
$users = get_users_of_blog( $blog_id );
$users = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ids' ) );
// Remove users from this blog.
if ( ! empty( $users ) ) {
foreach ( $users as $user ) {
remove_user_from_blog( $user->ID, $blog_id) ;
foreach ( $users as $user_id ) {
remove_user_from_blog( $user_id, $blog_id) ;
}
}

View File

@ -52,7 +52,7 @@ function confirm_delete_users( $users ) {
<br /><fieldset><p><legend><?php printf( __( "What should be done with posts and links owned by <em>%s</em>?" ), $delete_user->user_login ); ?></legend></p>
<?php
foreach ( (array) $blogs as $key => $details ) {
$blog_users = get_users_of_blog( $details->userblog_id );
$blog_users = get_users( array( 'blog_id' => $details->userblog_id ) );
if ( is_array( $blog_users ) && !empty( $blog_users ) ) {
$user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
$user_dropdown = "<select name='blog[$val][{$key}]'>";

View File

@ -2415,6 +2415,31 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
return true;
}
/**
* Get users for the blog.
*
* For setups that use the multi-blog feature. Can be used outside of the
* multi-blog feature.
*
* @since 2.2.0
* @deprecated 3.1.0
* @uses $wpdb WordPress database object for queries
* @uses $blog_id The Blog id of the blog for those that use more than one blog
*
* @param int $id Blog ID.
* @return array List of users that are part of that Blog ID
*/
function get_users_of_blog( $id = '' ) {
_deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
global $wpdb, $blog_id;
if ( empty($id) )
$id = (int) $blog_id;
$blog_prefix = $wpdb->get_blog_prefix($id);
$users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" );
return $users;
}
/**
* Enable/disable automatic general feed link outputting.
*

View File

@ -618,26 +618,6 @@ function get_users( $args = array() ) {
return (array) $user_search->get_results();
}
/**
* Get users for the blog.
*
* For setups that use the multi-blog feature. Can be used outside of the
* multi-blog feature.
*
* @since 2.2.0
* @uses get_users() for queries
* @uses $blog_id The Blog id of the blog for those that use more than one blog
*
* @param int $id Blog ID.
* @return array List of users that are part of that Blog ID
*/
function get_users_of_blog( $id = '' ) {
if ( empty( $id ) )
$id = get_current_blog_id();
return get_users( array( 'blog_id' => $id ) );
}
/**
* Get the blogs a user belongs to.
*