WordPress.org

Make WordPress Core

Changeset 17084


Ignore:
Timestamp:
12/20/2010 04:25:35 PM (9 years ago)
Author:
ryan
Message:

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

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ms.php

    r17009 r17084  
    6666    do_action( 'delete_blog', $blog_id, $drop );
    6767
    68     $users = get_users_of_blog( $blog_id );
     68    $users = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ids' ) );
    6969
    7070    // Remove users from this blog.
    7171    if ( ! empty( $users ) ) {
    72         foreach ( $users as $user ) {
    73             remove_user_from_blog( $user->ID, $blog_id) ;
     72        foreach ( $users as $user_id ) {
     73            remove_user_from_blog( $user_id, $blog_id) ;
    7474        }
    7575    }
  • trunk/wp-admin/network/edit.php

    r17042 r17084  
    5353                <?php
    5454                foreach ( (array) $blogs as $key => $details ) {
    55                     $blog_users = get_users_of_blog( $details->userblog_id );
     55                    $blog_users = get_users( array( 'blog_id' => $details->userblog_id ) );
    5656                    if ( is_array( $blog_users ) && !empty( $blog_users ) ) {
    5757                        $user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
  • trunk/wp-includes/deprecated.php

    r17009 r17084  
    24172417
    24182418/**
     2419 * Get users for the blog.
     2420 *
     2421 * For setups that use the multi-blog feature. Can be used outside of the
     2422 * multi-blog feature.
     2423 *
     2424 * @since 2.2.0
     2425 * @deprecated 3.1.0
     2426 * @uses $wpdb WordPress database object for queries
     2427 * @uses $blog_id The Blog id of the blog for those that use more than one blog
     2428 *
     2429 * @param int $id Blog ID.
     2430 * @return array List of users that are part of that Blog ID
     2431 */
     2432function get_users_of_blog( $id = '' ) {
     2433    _deprecated_function( __FUNCTION__, '3.1', 'get_users()' );
     2434
     2435    global $wpdb, $blog_id;
     2436    if ( empty($id) )
     2437        $id = (int) $blog_id;
     2438    $blog_prefix = $wpdb->get_blog_prefix($id);
     2439    $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" );
     2440    return $users;
     2441}
     2442
     2443/**
    24192444 * Enable/disable automatic general feed link outputting.
    24202445 *
  • trunk/wp-includes/user.php

    r17034 r17084  
    620620
    621621/**
    622  * Get users for the blog.
    623  *
    624  * For setups that use the multi-blog feature. Can be used outside of the
    625  * multi-blog feature.
    626  *
    627  * @since 2.2.0
    628  * @uses get_users() for queries
    629  * @uses $blog_id The Blog id of the blog for those that use more than one blog
    630  *
    631  * @param int $id Blog ID.
    632  * @return array List of users that are part of that Blog ID
    633  */
    634 function get_users_of_blog( $id = '' ) {
    635     if ( empty( $id ) )
    636         $id = get_current_blog_id();
    637 
    638     return get_users( array( 'blog_id' => $id ) );
    639 }
    640 
    641 /**
    642622 * Get the blogs a user belongs to.
    643623 *
Note: See TracChangeset for help on using the changeset viewer.