WordPress.org

Make WordPress Core

Ticket #15854: 15854.diff

File 15854.diff, 3.4 KB (added by scribu, 7 years ago)

Deprecated get_users_of_blog()

  • wp-includes/user.php

     
    619619}
    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 *
    644624 * @since 3.0.0
  • wp-includes/deprecated.php

     
    24162416}
    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 *
    24212446 * @since 2.8.0
  • wp-admin/includes/ms.php

     
    6565
    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        }
    7676
  • wp-admin/network/edit.php

     
    5252                                <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>
    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>";
    5858                                                $user_dropdown = "<select name='blog[$val][{$key}]'>";