Make WordPress Core

Ticket #35124: 35124.diff

File 35124.diff, 39.1 KB (added by kushang78, 3 years ago)

Added patch for this ticket.

  • src/wp-activate.php

    diff --git a/src/wp-activate.php b/src/wp-activate.php
    index 36772a2d9d..70cf4dfb84 100644
    a b $blog_details = get_site();  
    175175                        <?php
    176176                } else {
    177177                        $url  = isset( $result['blog_id'] ) ? get_home_url( (int) $result['blog_id'] ) : '';
    178                         $user = get_userdata( (int) $result['user_id'] );
     178                        $user = get_user( (int) $result['user_id'] );
    179179                        ?>
    180180                        <h2><?php _e( 'Your account is now active!' ); ?></h2>
    181181
  • src/wp-admin/edit-form-advanced.php

    diff --git a/src/wp-admin/edit-form-advanced.php b/src/wp-admin/edit-form-advanced.php
    index 16b699ca39..965775391b 100644
    a b if ( post_type_supports( $post_type, 'editor' ) ) {  
    647647        <?php
    648648        if ( 'auto-draft' !== $post->post_status ) {
    649649                echo '<span id="last-edit">';
    650                 $last_user = get_userdata( get_post_meta( $post->ID, '_edit_last', true ) );
     650                $last_user = get_user( get_post_meta( $post->ID, '_edit_last', true ) );
    651651                if ( $last_user ) {
    652652                        printf(
    653653                                /* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time. */
  • src/wp-admin/edit-form-blocks.php

    diff --git a/src/wp-admin/edit-form-blocks.php b/src/wp-admin/edit-form-blocks.php
    index 93dea2eb91..09a7f3df3a 100644
    a b if ( $user_id ) {  
    154154
    155155        $user_details = null;
    156156        if ( $locked ) {
    157                 $user         = get_userdata( $user_id );
     157                $user         = get_user( $user_id );
    158158                $user_details = array(
    159159                        'avatar' => get_avatar_url( $user_id, array( 'size' => 128 ) ),
    160160                        'name'   => $user->display_name,
  • src/wp-admin/includes/ajax-actions.php

    diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php
    index b8e8246eb7..301d577c72 100644
    a b function wp_ajax_add_user( $action ) {  
    17591759                $x->send();
    17601760        }
    17611761
    1762         $user_object   = get_userdata( $user_id );
     1762        $user_object   = get_user( $user_id );
    17631763        $wp_list_table = _get_list_table( 'WP_Users_List_Table' );
    17641764
    17651765        $role = current( $user_object->roles );
    function wp_ajax_inline_save() {  
    20742074
    20752075        $last = wp_check_post_lock( $post_id );
    20762076        if ( $last ) {
    2077                 $last_user      = get_userdata( $last );
     2077                $last_user      = get_user( $last );
    20782078                $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' );
    20792079
    20802080                /* translators: %s: User's display name. */
    function wp_ajax_wp_fullscreen_save_post() {  
    28902890
    28912891        $last_id = get_post_meta( $post_id, '_edit_last', true );
    28922892        if ( $last_id ) {
    2893                 $last_user = get_userdata( $last_id );
     2893                $last_user = get_user( $last_id );
    28942894                /* translators: 1: User's display name, 2: Date of last edit, 3: Time of last edit. */
    28952895                $last_edited = sprintf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), $last_date, $last_time );
    28962896        } else {
    function wp_ajax_parse_media_shortcode() {  
    39643964 * @since 4.1.0
    39653965 */
    39663966function wp_ajax_destroy_sessions() {
    3967         $user = get_userdata( (int) $_POST['user_id'] );
     3967        $user = get_user( (int) $_POST['user_id'] );
    39683968
    39693969        if ( $user ) {
    39703970                if ( ! current_user_can( 'edit_user', $user->ID ) ) {
    function wp_ajax_send_password_reset() {  
    56035603        }
    56045604
    56055605        // Send the password reset link.
    5606         $user    = get_userdata( $user_id );
     5606        $user    = get_user( $user_id );
    56075607        $results = retrieve_password( $user->user_login );
    56085608
    56095609        if ( true === $results ) {
  • src/wp-admin/includes/class-wp-posts-list-table.php

    diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php
    index baf3ef6c6f..e67b5e2653 100644
    a b class WP_Posts_List_Table extends WP_List_Table {  
    11151115                        $lock_holder = wp_check_post_lock( $post->ID );
    11161116
    11171117                        if ( $lock_holder ) {
    1118                                 $lock_holder   = get_userdata( $lock_holder );
     1118                                $lock_holder   = get_user( $lock_holder );
    11191119                                $locked_avatar = get_avatar( $lock_holder->ID, 18 );
    11201120                                /* translators: %s: User's display name. */
    11211121                                $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
  • src/wp-admin/includes/class-wp-users-list-table.php

    diff --git a/src/wp-admin/includes/class-wp-users-list-table.php b/src/wp-admin/includes/class-wp-users-list-table.php
    index 8dfe3ce1a3..dd91559c32 100644
    a b class WP_Users_List_Table extends WP_List_Table {  
    432432         */
    433433        public function single_row( $user_object, $style = '', $role = '', $numposts = 0 ) {
    434434                if ( ! ( $user_object instanceof WP_User ) ) {
    435                         $user_object = get_userdata( (int) $user_object );
     435                        $user_object = get_user( (int) $user_object );
    436436                }
    437437                $user_object->filter = 'display';
    438438                $email               = $user_object->user_email;
  • src/wp-admin/includes/deprecated.php

    diff --git a/src/wp-admin/includes/deprecated.php b/src/wp-admin/includes/deprecated.php
    index f7805b4cc7..822d6ffaba 100644
    a b function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'p  
    286286
    287287        global $wpdb;
    288288
    289         if ( ! $user = get_userdata( $user_id ) )
     289        if ( ! $user = get_user( $user_id ) )
    290290                return array();
    291291        $post_type_obj = get_post_type_object($post_type);
    292292
  • src/wp-admin/includes/export.php

    diff --git a/src/wp-admin/includes/export.php b/src/wp-admin/includes/export.php
    index 9610ac8c9f..f48e2ae427 100644
    a b function export_wp( $args = array() ) {  
    368368                $authors = array();
    369369                $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and" );
    370370                foreach ( (array) $results as $result ) {
    371                         $authors[] = get_userdata( $result->post_author );
     371                        $authors[] = get_user( $result->post_author );
    372372                }
    373373
    374374                $authors = array_filter( $authors );
  • src/wp-admin/includes/misc.php

    diff --git a/src/wp-admin/includes/misc.php b/src/wp-admin/includes/misc.php
    index 3f48065cdf..51a5fa5ba2 100644
    a b function wp_check_locked_posts( $response, $data, $screen_id ) {  
    11481148                        $user_id = wp_check_post_lock( $post_id );
    11491149
    11501150                        if ( $user_id ) {
    1151                                 $user = get_userdata( $user_id );
     1151                                $user = get_user( $user_id );
    11521152
    11531153                                if ( $user && current_user_can( 'edit_post', $post_id ) ) {
    11541154                                        $send = array(
    function wp_refresh_post_lock( $response, $data, $screen_id ) {  
    12011201                }
    12021202
    12031203                $user_id = wp_check_post_lock( $post_id );
    1204                 $user    = get_userdata( $user_id );
     1204                $user    = get_user( $user_id );
    12051205
    12061206                if ( $user ) {
    12071207                        $error = array(
  • src/wp-admin/includes/ms.php

    diff --git a/src/wp-admin/includes/ms.php b/src/wp-admin/includes/ms.php
    index 02ddf945aa..cc603e94df 100644
    a b function upload_space_setting( $id ) {  
    330330function refresh_user_details( $id ) {
    331331        $id = (int) $id;
    332332
    333         $user = get_userdata( $id );
     333        $user = get_user( $id );
    334334        if ( ! $user ) {
    335335                return false;
    336336        }
    function confirm_delete_users( $users ) {  
    883883        $allusers = (array) $_POST['allusers'];
    884884        foreach ( $allusers as $user_id ) {
    885885                if ( '' !== $user_id && '0' !== $user_id ) {
    886                         $delete_user = get_userdata( $user_id );
     886                        $delete_user = get_user( $user_id );
    887887
    888888                        if ( ! current_user_can( 'delete_user', $delete_user->ID ) ) {
    889889                                wp_die(
  • src/wp-admin/includes/post.php

    diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php
    index c93ac71bec..6f6525af3f 100644
    a b function wp_check_post_lock( $post ) {  
    17001700        $time = $lock[0];
    17011701        $user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true );
    17021702
    1703         if ( ! get_userdata( $user ) ) {
     1703        if ( ! get_user( $user ) ) {
    17041704                return false;
    17051705        }
    17061706
    function _admin_notice_post_locked() {  
    17651765        $user_id = wp_check_post_lock( $post->ID );
    17661766
    17671767        if ( $user_id ) {
    1768                 $user = get_userdata( $user_id );
     1768                $user = get_user( $user_id );
    17691769        }
    17701770
    17711771        if ( $user ) {
  • src/wp-admin/includes/user.php

    diff --git a/src/wp-admin/includes/user.php b/src/wp-admin/includes/user.php
    index abed2d2015..813cd8db5a 100644
    a b function edit_user( $user_id = 0 ) {  
    3434        if ( $user_id ) {
    3535                $update           = true;
    3636                $user->ID         = $user_id;
    37                 $userdata         = get_userdata( $user_id );
     37                $userdata         = get_user( $user_id );
    3838                $user->user_login = wp_slash( $userdata->user_login );
    3939        } else {
    4040                $update = false;
    function get_editable_roles() {  
    289289 * @return WP_User|false WP_User object on success, false on failure.
    290290 */
    291291function get_user_to_edit( $user_id ) {
    292         $user = get_userdata( $user_id );
     292        $user = get_user( $user_id );
    293293
    294294        if ( $user ) {
    295295                $user->filter = 'edit';
    function default_password_nag_edit_user( $user_ID, $old_data ) {  
    514514                return;
    515515        }
    516516
    517         $new_data = get_userdata( $user_ID );
     517        $new_data = get_user( $user_ID );
    518518
    519519        // Remove the nag if the password has been changed.
    520520        if ( $new_data->user_pass !== $old_data->user_pass ) {
  • src/wp-admin/network/site-users.php

    diff --git a/src/wp-admin/network/site-users.php b/src/wp-admin/network/site-users.php
    index 78af65b9ed..cb8ece30d2 100644
    a b if ( $action ) {  
    161161                                                );
    162162                                        }
    163163
    164                                         $user = get_userdata( $user_id );
     164                                        $user = get_user( $user_id );
    165165                                        $user->set_role( $role );
    166166                                }
    167167                        } else {
  • src/wp-admin/network/users.php

    diff --git a/src/wp-admin/network/users.php b/src/wp-admin/network/users.php
    index d0b40e710d..eef3e2e705 100644
    a b if ( isset( $_GET['action'] ) ) {  
    7979                                                                exit;
    8080
    8181                                                        case 'spam':
    82                                                                 $user = get_userdata( $user_id );
     82                                                                $user = get_user( $user_id );
    8383                                                                if ( is_super_admin( $user->ID ) ) {
    8484                                                                        wp_die(
    8585                                                                                sprintf(
    if ( isset( $_GET['action'] ) ) {  
    106106                                                                break;
    107107
    108108                                                        case 'notspam':
    109                                                                 $user = get_userdata( $user_id );
     109                                                                $user = get_user( $user_id );
    110110
    111111                                                                $userfunction = 'all_notspam';
    112112                                                                $blogs        = get_blogs_of_user( $user_id, true );
  • src/wp-admin/post.php

    diff --git a/src/wp-admin/post.php b/src/wp-admin/post.php
    index 17875cb3e5..f44102262b 100644
    a b switch ( $action ) {  
    252252
    253253                $user_id = wp_check_post_lock( $post_id );
    254254                if ( $user_id ) {
    255                         $user = get_userdata( $user_id );
     255                        $user = get_user( $user_id );
    256256                        /* translators: %s: User's display name. */
    257257                        wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
    258258                }
  • src/wp-admin/user-edit.php

    diff --git a/src/wp-admin/user-edit.php b/src/wp-admin/user-edit.php
    index bbb321a272..b77a78dc6d 100644
    a b if ( ! $user_id && IS_PROFILE_PAGE ) {  
    2525        $user_id = $current_user->ID;
    2626} elseif ( ! $user_id && ! IS_PROFILE_PAGE ) {
    2727        wp_die( __( 'Invalid user ID.' ) );
    28 } elseif ( ! get_userdata( $user_id ) ) {
     28} elseif ( ! get_user( $user_id ) ) {
    2929        wp_die( __( 'Invalid user ID.' ) );
    3030}
    3131
    switch ( $action ) {  
    159159
    160160                // Update the email address in signups, if present.
    161161                if ( is_multisite() ) {
    162                         $user = get_userdata( $user_id );
     162                        $user = get_user( $user_id );
    163163
    164164                        if ( $user->user_login && isset( $_POST['email'] ) && is_email( $_POST['email'] ) && $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $user->user_login ) ) ) {
    165165                                $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $_POST['email'], $user_login ) );
  • src/wp-admin/users.php

    diff --git a/src/wp-admin/users.php b/src/wp-admin/users.php
    index 94d891ae0c..ab997a13f2 100644
    a b switch ( $wp_list_table->current_action() ) {  
    161161                                );
    162162                        }
    163163
    164                         $user = get_userdata( $id );
     164                        $user = get_user( $id );
    165165                        $user->set_role( $role );
    166166                }
    167167
    switch ( $wp_list_table->current_action() ) {  
    255255                        }
    256256
    257257                        // Send the password reset link.
    258                         $user = get_userdata( $id );
     258                        $user = get_user( $id );
    259259                        if ( true === retrieve_password( $user->user_login ) ) {
    260260                                ++$reset_count;
    261261                        }
    switch ( $wp_list_table->current_action() ) {  
    361361                $go_delete = 0;
    362362
    363363                foreach ( $all_user_ids as $id ) {
    364                         $user = get_userdata( $id );
     364                        $user = get_user( $id );
    365365
    366366                        if ( $id === $current_user->ID ) {
    367367                                echo '<li>';
    switch ( $wp_list_table->current_action() ) {  
    528528                $go_remove = false;
    529529
    530530                foreach ( $user_ids as $id ) {
    531                         $user = get_userdata( $id );
     531                        $user = get_user( $id );
    532532
    533533                        if ( ! current_user_can( 'remove_user', $id ) ) {
    534534                                echo '<li>';
  • src/wp-content/themes/twentynineteen/inc/helper-functions.php

    diff --git a/src/wp-content/themes/twentynineteen/inc/helper-functions.php b/src/wp-content/themes/twentynineteen/inc/helper-functions.php
    index c18275604a..49a991913e 100644
    a b function twentynineteen_get_avatar_size() {  
    3535 */
    3636function twentynineteen_is_comment_by_post_author( $comment = null ) {
    3737        if ( is_object( $comment ) && $comment->user_id > 0 ) {
    38                 $user = get_userdata( $comment->user_id );
     38                $user = get_user( $comment->user_id );
    3939                $post = get_post( $comment->comment_post_ID );
    4040                if ( ! empty( $user ) && ! empty( $post ) ) {
    4141                        return $comment->user_id === $post->post_author;
  • src/wp-content/themes/twentytwenty/inc/template-tags.php

    diff --git a/src/wp-content/themes/twentytwenty/inc/template-tags.php b/src/wp-content/themes/twentytwenty/inc/template-tags.php
    index 8014eb4123..2b2ac62af2 100644
    a b function twentytwenty_is_comment_by_post_author( $comment = null ) {  
    143143
    144144        if ( is_object( $comment ) && $comment->user_id > 0 ) {
    145145
    146                 $user = get_userdata( $comment->user_id );
     146                $user = get_user( $comment->user_id );
    147147                $post = get_post( $comment->comment_post_ID );
    148148
    149149                if ( ! empty( $user ) && ! empty( $post ) ) {
  • src/wp-includes/admin-bar.php

    diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php
    index 3eba2668fa..ce6e6cfeb3 100644
    a b function wp_admin_bar_edit_menu( $wp_admin_bar ) {  
    873873                                );
    874874                        }
    875875                } elseif ( 'user-edit' === $current_screen->base && isset( $user_id ) ) {
    876                         $user_object = get_userdata( $user_id );
     876                        $user_object = get_user( $user_id );
    877877                        $view_link   = get_author_posts_url( $user_object->ID );
    878878                        if ( $user_object->exists() && $view_link ) {
    879879                                $wp_admin_bar->add_node(
  • src/wp-includes/author-template.php

    diff --git a/src/wp-includes/author-template.php b/src/wp-includes/author-template.php
    index 184d7d0f38..825e3a14f9 100644
    a b function get_the_modified_author() {  
    9393        $last_id = get_post_meta( get_post()->ID, '_edit_last', true );
    9494
    9595        if ( $last_id ) {
    96                 $last_user = get_userdata( $last_id );
     96                $last_user = get_user( $last_id );
    9797
    9898                /**
    9999                 * Filters the display name of the author who last edited the current post.
    function get_the_author_meta( $field = '', $user_id = false ) {  
    166166                global $authordata;
    167167                $user_id = isset( $authordata->ID ) ? $authordata->ID : 0;
    168168        } else {
    169                 $authordata = get_userdata( $user_id );
     169                $authordata = get_user( $user_id );
    170170        }
    171171
    172172        if ( in_array( $field, array( 'login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status' ), true ) ) {
    function get_author_posts_url( $author_id, $author_nicename = '' ) {  
    372372                $link = $file . '?author=' . $author_id;
    373373        } else {
    374374                if ( '' === $author_nicename ) {
    375                         $user = get_userdata( $author_id );
     375                        $user = get_user( $author_id );
    376376                        if ( ! empty( $user->user_nicename ) ) {
    377377                                $author_nicename = $user->user_nicename;
    378378                        }
    function wp_list_authors( $args = '' ) {  
    503503                        continue;
    504504                }
    505505
    506                 $author = get_userdata( $author_id );
     506                $author = get_user( $author_id );
    507507
    508508                if ( $parsed_args['exclude_admin'] && 'admin' === $author->display_name ) {
    509509                        continue;
  • src/wp-includes/canonical.php

    diff --git a/src/wp-includes/canonical.php b/src/wp-includes/canonical.php
    index 0b94791fd9..8755af3921 100644
    a b function redirect_canonical( $requested_url = null, $do_redirect = true ) {  
    319319                } elseif ( is_author() && ! empty( $_GET['author'] )
    320320                        && is_string( $_GET['author'] ) && preg_match( '|^[0-9]+$|', $_GET['author'] )
    321321                ) {
    322                         $author = get_userdata( get_query_var( 'author' ) );
     322                        $author = get_user( get_query_var( 'author' ) );
    323323
    324324                        if ( false !== $author
    325325                                && $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_author = %d AND $wpdb->posts.post_status = 'publish' LIMIT 1", $author->ID ) )
  • src/wp-includes/capabilities.php

    diff --git a/src/wp-includes/capabilities.php b/src/wp-includes/capabilities.php
    index 26b150fe4b..e718344bc2 100644
    a b function author_can( $post, $capability, ...$args ) {  
    940940                return false;
    941941        }
    942942
    943         $author = get_userdata( $post->post_author );
     943        $author = get_user( $post->post_author );
    944944
    945945        if ( ! $author ) {
    946946                return false;
    function author_can( $post, $capability, ...$args ) {  
    973973 */
    974974function user_can( $user, $capability, ...$args ) {
    975975        if ( ! is_object( $user ) ) {
    976                 $user = get_userdata( $user );
     976                $user = get_user( $user );
    977977        }
    978978
    979979        if ( empty( $user ) ) {
    function is_super_admin( $user_id = false ) {  
    10761076        if ( ! $user_id ) {
    10771077                $user = wp_get_current_user();
    10781078        } else {
    1079                 $user = get_userdata( $user_id );
     1079                $user = get_user( $user_id );
    10801080        }
    10811081
    10821082        if ( ! $user || ! $user->exists() ) {
    function grant_super_admin( $user_id ) {  
    11261126        // Directly fetch site_admins instead of using get_super_admins().
    11271127        $super_admins = get_site_option( 'site_admins', array( 'admin' ) );
    11281128
    1129         $user = get_userdata( $user_id );
     1129        $user = get_user( $user_id );
    11301130        if ( $user && ! in_array( $user->user_login, $super_admins, true ) ) {
    11311131                $super_admins[] = $user->user_login;
    11321132                update_site_option( 'site_admins', $super_admins );
    function revoke_super_admin( $user_id ) {  
    11731173        // Directly fetch site_admins instead of using get_super_admins().
    11741174        $super_admins = get_site_option( 'site_admins', array( 'admin' ) );
    11751175
    1176         $user = get_userdata( $user_id );
     1176        $user = get_user( $user_id );
    11771177        if ( $user && 0 !== strcasecmp( $user->user_email, get_site_option( 'admin_email' ) ) ) {
    11781178                $key = array_search( $user->user_login, $super_admins, true );
    11791179                if ( false !== $key ) {
  • src/wp-includes/class-wp-customize-manager.php

    diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php
    index d12eea0e5f..b6f4c0cf4b 100644
    a b final class WP_Customize_Manager {  
    33233323                        return null;
    33243324                }
    33253325
    3326                 $lock_user = get_userdata( $user_id );
     3326                $lock_user = get_user( $user_id );
    33273327
    33283328                if ( ! $lock_user ) {
    33293329                        return null;
  • src/wp-includes/class-wp-query.php

    diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php
    index e6a3e6b743..6ee572c744 100644
    a b class WP_Query {  
    39173917                                }
    39183918                        }
    39193919
    3920                         $this->queried_object = get_userdata( $this->queried_object_id );
     3920                        $this->queried_object = get_user( $this->queried_object_id );
    39213921                }
    39223922
    39233923                return $this->queried_object;
    class WP_Query {  
    47494749
    47504750                $id = (int) $post->ID;
    47514751
    4752                 $authordata = get_userdata( $post->post_author );
     4752                $authordata = get_user( $post->post_author );
    47534753
    47544754                $currentday   = false;
    47554755                $currentmonth = false;
  • src/wp-includes/class-wp-xmlrpc-server.php

    diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php
    index ae9a658718..d5d4e970cd 100644
    a b class wp_xmlrpc_server extends IXR_Server {  
    11241124                }
    11251125
    11261126                // Get the author info.
    1127                 $author = get_userdata( $page->post_author );
     1127                $author = get_user( $page->post_author );
    11281128
    11291129                $page_template = get_page_template_slug( $page->ID );
    11301130                if ( empty( $page_template ) ) {
    class wp_xmlrpc_server extends IXR_Server {  
    14931493                                return new IXR_Error( 401, __( 'Sorry, you are not allowed to create posts as this user.' ) );
    14941494                        }
    14951495
    1496                         $author = get_userdata( $post_data['post_author'] );
     1496                        $author = get_user( $post_data['post_author'] );
    14971497
    14981498                        if ( ! $author ) {
    14991499                                return new IXR_Error( 404, __( 'Invalid author ID.' ) );
    class wp_xmlrpc_server extends IXR_Server {  
    26492649         * names can be used to specify multiple fields. The available conceptual
    26502650         * groups are 'basic' and 'all'.
    26512651         *
    2652          * @uses get_userdata()
     2652         * @uses get_user()
    26532653         *
    26542654         * @param array $args {
    26552655         *     Method arguments. Note: arguments must be ordered as documented.
    class wp_xmlrpc_server extends IXR_Server {  
    27112711                        return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this user.' ) );
    27122712                }
    27132713
    2714                 $user_data = get_userdata( $user_id );
     2714                $user_data = get_user( $user_id );
    27152715
    27162716                if ( ! $user_data ) {
    27172717                        return new IXR_Error( 404, __( 'Invalid user ID.' ) );
    class wp_xmlrpc_server extends IXR_Server {  
    28132813        /**
    28142814         * Retrieves information about the requesting user.
    28152815         *
    2816          * @uses get_userdata()
     2816         * @uses get_user()
    28172817         *
    28182818         * @param array $args {
    28192819         *     Method arguments. Note: arguments must be ordered as documented.
    class wp_xmlrpc_server extends IXR_Server {  
    28542854                        return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit your profile.' ) );
    28552855                }
    28562856
    2857                 $user_data = get_userdata( $user->ID );
     2857                $user_data = get_user( $user->ID );
    28582858
    28592859                return $this->_prepare_user( $user_data, $fields );
    28602860        }
    class wp_xmlrpc_server extends IXR_Server {  
    54645464                                default:
    54655465                                        return new IXR_Error( 401, __( 'Invalid post type.' ) );
    54665466                        }
    5467                         $author = get_userdata( $content_struct['wp_author_id'] );
     5467                        $author = get_user( $content_struct['wp_author_id'] );
    54685468                        if ( ! $author ) {
    54695469                                return new IXR_Error( 404, __( 'Invalid author ID.' ) );
    54705470                        }
    class wp_xmlrpc_server extends IXR_Server {  
    61066106                        $link = get_permalink( $postdata['ID'] );
    61076107
    61086108                        // Get the author info.
    6109                         $author = get_userdata( $postdata['post_author'] );
     6109                        $author = get_user( $postdata['post_author'] );
    61106110
    61116111                        $allow_comments = ( 'open' === $postdata['comment_status'] ) ? 1 : 0;
    61126112                        $allow_pings    = ( 'open' === $postdata['ping_status'] ) ? 1 : 0;
    class wp_xmlrpc_server extends IXR_Server {  
    62586258                        $link = get_permalink( $entry['ID'] );
    62596259
    62606260                        // Get the post author info.
    6261                         $author = get_userdata( $entry['post_author'] );
     6261                        $author = get_user( $entry['post_author'] );
    62626262
    62636263                        $allow_comments = ( 'open' === $entry['comment_status'] ) ? 1 : 0;
    62646264                        $allow_pings    = ( 'open' === $entry['ping_status'] ) ? 1 : 0;
  • src/wp-includes/class-wp.php

    diff --git a/src/wp-includes/class-wp.php b/src/wp-includes/class-wp.php
    index ce88c102cf..0213beeb2f 100644
    a b class WP {  
    670670                }
    671671
    672672                if ( $wp_query->is_author() ) {
    673                         $GLOBALS['authordata'] = get_userdata( get_queried_object_id() );
     673                        $GLOBALS['authordata'] = get_user( get_queried_object_id() );
    674674                }
    675675        }
    676676
  • src/wp-includes/comment-template.php

    diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php
    index a1005d56e2..78249fbc17 100644
    a b function get_comment_author( $comment_id = 0 ) {  
    2727        $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : $comment_id;
    2828
    2929        if ( empty( $comment->comment_author ) ) {
    30                 $user = ! empty( $comment->user_id ) ? get_userdata( $comment->user_id ) : false;
     30                $user = ! empty( $comment->user_id ) ? get_user( $comment->user_id ) : false;
    3131                if ( $user ) {
    3232                        $comment_author = $user->display_name;
    3333                } else {
    function get_comment_class( $css_class = '', $comment_id = null, $post = null )  
    519519        $classes[] = ( empty( $comment->comment_type ) ) ? 'comment' : $comment->comment_type;
    520520
    521521        // Add classes for comment authors that are registered users.
    522         $user = $comment->user_id ? get_userdata( $comment->user_id ) : false;
     522        $user = $comment->user_id ? get_user( $comment->user_id ) : false;
    523523        if ( $user ) {
    524524                $classes[] = 'byuser';
    525525                $classes[] = 'comment-author-' . sanitize_html_class( $user->user_nicename, $comment->user_id );
  • src/wp-includes/comment.php

    diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
    index de23a72130..e342a7f9d9 100644
    a b function wp_allow_comment( $commentdata, $wp_error = false ) {  
    772772        }
    773773
    774774        if ( ! empty( $commentdata['user_id'] ) ) {
    775                 $user        = get_userdata( $commentdata['user_id'] );
     775                $user        = get_user( $commentdata['user_id'] );
    776776                $post_author = $wpdb->get_var(
    777777                        $wpdb->prepare(
    778778                                "SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1",
  • src/wp-includes/deprecated.php

    diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php
    index e63708f91b..cabf5f5076 100644
    a b function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat=  
    206206function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') {
    207207        _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
    208208
    209         $author_data = get_userdata($user_id);
     209        $author_data = get_user($user_id);
    210210        return ($author_data->user_level > 1);
    211211}
    212212
    function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') {  
    225225function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {
    226226        _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
    227227
    228         $author_data = get_userdata($user_id);
     228        $author_data = get_user($user_id);
    229229        return ($author_data->user_level >= 1);
    230230}
    231231
    function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {  
    244244function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
    245245        _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
    246246
    247         $author_data = get_userdata($user_id);
     247        $author_data = get_user($user_id);
    248248        $post = get_post($post_id);
    249         $post_author_data = get_userdata($post->post_author);
     249        $post_author_data = get_user($post->post_author);
    250250
    251251        if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
    252252                        || ($author_data->user_level > $post_author_data->user_level)
    function user_can_delete_post($user_id, $post_id, $blog_id = 1) {  
    291291function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
    292292        _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
    293293
    294         $author_data = get_userdata($user_id);
     294        $author_data = get_user($user_id);
    295295        return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id));
    296296}
    297297
    function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {  
    310310function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
    311311        _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
    312312
    313         $author_data = get_userdata($user_id);
     313        $author_data = get_user($user_id);
    314314        return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id));
    315315}
    316316
    function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {  
    366366function user_can_edit_user($user_id, $other_user) {
    367367        _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
    368368
    369         $user  = get_userdata($user_id);
    370         $other = get_userdata($other_user);
     369        $user  = get_user($user_id);
     370        $other = get_user($other_user);
    371371        if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID )
    372372                return true;
    373373        else
  • src/wp-includes/embed.php

    diff --git a/src/wp-includes/embed.php b/src/wp-includes/embed.php
    index 9e59f1abc0..2adb1b2020 100644
    a b function get_oembed_response_data( $post, $width ) {  
    589589                'type'          => 'link',
    590590        );
    591591
    592         $author = get_userdata( $post->post_author );
     592        $author = get_user( $post->post_author );
    593593
    594594        if ( $author ) {
    595595                $data['author_name'] = $author->display_name;
  • src/wp-includes/link-template.php

    diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php
    index 9f3d9a97ee..738f8e27af 100644
    a b function get_permalink( $post = 0, $leavename = false ) {  
    263263
    264264                $author = '';
    265265                if ( str_contains( $permalink, '%author%' ) ) {
    266                         $authordata = get_userdata( $post->post_author );
     266                        $authordata = get_user( $post->post_author );
    267267                        $author     = $authordata->user_nicename;
    268268                }
    269269
    function get_edit_user_link( $user_id = null ) {  
    17311731                return '';
    17321732        }
    17331733
    1734         $user = get_userdata( $user_id );
     1734        $user = get_user( $user_id );
    17351735
    17361736        if ( ! $user ) {
    17371737                return '';
  • src/wp-includes/ms-functions.php

    diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php
    index 913f22543f..1ec9ba6b18 100644
    a b function get_blog_post( $blog_id, $post_id ) {  
    152152function add_user_to_blog( $blog_id, $user_id, $role ) {
    153153        switch_to_blog( $blog_id );
    154154
    155         $user = get_userdata( $user_id );
     155        $user = get_user( $user_id );
    156156
    157157        if ( ! $user ) {
    158158                restore_current_blog();
    function remove_user_from_blog( $user_id, $blog_id = 0, $reassign = 0 ) {  
    267267                update_user_meta( $user_id, 'source_domain', $new_domain );
    268268        }
    269269
    270         $user = get_userdata( $user_id );
     270        $user = get_user( $user_id );
    271271        if ( ! $user ) {
    272272                restore_current_blog();
    273273                return new WP_Error( 'user_does_not_exist', __( 'That user does not exist.' ) );
    function newuser_notify_siteadmin( $user_id ) {  
    14981498                return false;
    14991499        }
    15001500
    1501         $user = get_userdata( $user_id );
     1501        $user = get_user( $user_id );
    15021502
    15031503        $options_site_url = esc_url( network_admin_url( 'settings.php' ) );
    15041504
    function wpmu_welcome_notification( $blog_id, $user_id, $password, $title, $meta  
    16151615                return false;
    16161616        }
    16171617
    1618         $user = get_userdata( $user_id );
     1618        $user = get_user( $user_id );
    16191619
    16201620        $switched_locale = switch_to_user_locale( $user_id );
    16211621
    We hope you enjoy your new site. Thanks!  
    17141714 */
    17151715function wpmu_new_site_admin_notification( $site_id, $user_id ) {
    17161716        $site  = get_site( $site_id );
    1717         $user  = get_userdata( $user_id );
     1717        $user  = get_user( $user_id );
    17181718        $email = get_site_option( 'admin_email' );
    17191719
    17201720        if ( ! $site || ! $user || ! $email ) {
    function wpmu_welcome_user_notification( $user_id, $password, $meta = array() )  
    18481848
    18491849        $welcome_email = get_site_option( 'welcome_user_email' );
    18501850
    1851         $user = get_userdata( $user_id );
     1851        $user = get_user( $user_id );
    18521852
    18531853        $switched_locale = switch_to_user_locale( $user_id );
    18541854
    function wpmu_log_new_registrations( $blog_id, $user_id ) {  
    20462046                $user_id = ! empty( $user_id['user_id'] ) ? $user_id['user_id'] : 0;
    20472047        }
    20482048
    2049         $user = get_userdata( (int) $user_id );
     2049        $user = get_user( (int) $user_id );
    20502050        if ( $user ) {
    20512051                $wpdb->insert(
    20522052                        $wpdb->registration_log,
  • src/wp-includes/pluggable.php

    diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php
    index c0bbcfe02e..bbf0cc4161 100644
    a b if ( ! function_exists( 'wp_get_current_user' ) ) :  
    7171        }
    7272endif;
    7373
    74 if ( ! function_exists( 'get_userdata' ) ) :
    75         /**
     74if ( ! function_exists( 'get_user' ) ) :
     75        /*
    7676         * Retrieves user info by user ID.
    7777         *
    7878         * @since 0.71
    if ( ! function_exists( 'get_userdata' ) ) :  
    8080         * @param int $user_id User ID
    8181         * @return WP_User|false WP_User object on success, false on failure.
    8282         */
    83         function get_userdata( $user_id ) {
     83        function get_user( $user_id ) { // get_userdata()
    8484                return get_user_by( 'id', $user_id );
    8585        }
    8686endif;
    endif;  
    114114
    115115if ( ! function_exists( 'cache_users' ) ) :
    116116        /**
    117          * Retrieves info for user lists to prevent multiple queries by get_userdata().
     117         * Retrieves info for user lists to prevent multiple queries by get_user().
    118118         *
    119119         * @since 3.0.0
    120120         *
    if ( ! function_exists( 'wp_generate_auth_cookie' ) ) :  
    855855         * @return string Authentication cookie contents. Empty string if user does not exist.
    856856         */
    857857        function wp_generate_auth_cookie( $user_id, $expiration, $scheme = 'auth', $token = '' ) {
    858                 $user = get_userdata( $user_id );
     858                $user = get_user( $user_id );
    859859                if ( ! $user ) {
    860860                        return '';
    861861                }
    if ( ! function_exists( 'wp_notify_postauthor' ) ) :  
    16531653                }
    16541654
    16551655                $post   = get_post( $comment->comment_post_ID );
    1656                 $author = get_userdata( $post->post_author );
     1656                $author = get_user( $post->post_author );
    16571657
    16581658                // Who to notify? By default, just the post author, but others can be added.
    16591659                $emails = array();
    if ( ! function_exists( 'wp_notify_moderator' ) ) :  
    18991899
    19001900                $comment = get_comment( $comment_id );
    19011901                $post    = get_post( $comment->comment_post_ID );
    1902                 $user    = get_userdata( $post->post_author );
     1902                $user    = get_user( $post->post_author );
    19031903                // Send to the administration and to the post author if the author can modify the comment.
    19041904                $emails = array( get_option( 'admin_email' ) );
    19051905                if ( $user && user_can( $user->ID, 'edit_comment', $comment_id ) && ! empty( $user->user_email ) ) {
    if ( ! function_exists( 'wp_new_user_notification' ) ) :  
    21332133                        return;
    21342134                }
    21352135
    2136                 $user = get_userdata( $user_id );
     2136                $user = get_user( $user_id );
    21372137
    21382138                /*
    21392139                 * The blogname option is escaped with esc_html() on the way into the database in sanitize_option().
  • src/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php

    diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php
    index b0ac65a647..aaf0fe0b21 100644
    a b class WP_REST_Application_Passwords_Controller extends WP_REST_Controller {  
    712712                                return $error;
    713713                        }
    714714
    715                         $user = get_userdata( $id );
     715                        $user = get_user( $id );
    716716                }
    717717
    718718                if ( empty( $user ) || ! $user->exists() ) {
  • src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
    index b9a58b63fb..3d5bad922a 100644
    a b class WP_REST_Posts_Controller extends WP_REST_Controller {  
    12931293                        $post_author = (int) $request['author'];
    12941294
    12951295                        if ( get_current_user_id() !== $post_author ) {
    1296                                 $user_obj = get_userdata( $post_author );
     1296                                $user_obj = get_user( $post_author );
    12971297
    12981298                                if ( ! $user_obj ) {
    12991299                                        return new WP_Error(
  • src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php

    diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php
    index 53f8faa755..9c9c89cc95 100644
    a b class WP_REST_Templates_Controller extends WP_REST_Controller {  
    605605                        $post_author = (int) $request['author'];
    606606
    607607                        if ( get_current_user_id() !== $post_author ) {
    608                                 $user_obj = get_userdata( $post_author );
     608                                $user_obj = get_user( $post_author );
    609609
    610610                                if ( ! $user_obj ) {
    611611                                        return new WP_Error(
  • src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

    diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
    index 9b38470631..083d39a737 100644
    a b class WP_REST_Users_Controller extends WP_REST_Controller {  
    407407                        return $error;
    408408                }
    409409
    410                 $user = get_userdata( (int) $id );
     410                $user = get_user( (int) $id );
    411411                if ( empty( $user ) || ! $user->exists() ) {
    412412                        return $error;
    413413                }
    class WP_REST_Users_Controller extends WP_REST_Controller {  
    899899                }
    900900
    901901                if ( ! empty( $reassign ) ) {
    902                         if ( $reassign === $id || ! get_userdata( $reassign ) ) {
     902                        if ( $reassign === $id || ! get_user( $reassign ) ) {
    903903                                return new WP_Error(
    904904                                        'rest_user_invalid_reassign',
    905905                                        __( 'Invalid user ID for reassignment.' ),
  • src/wp-includes/user.php

    diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php
    index 5dbff2b929..393c450267 100644
    a b function get_user_option( $option, $user = 0, $deprecated = '' ) {  
    670670                $user = get_current_user_id();
    671671        }
    672672
    673         $user = get_userdata( $user );
     673        $user = get_user( $user );
    674674        if ( ! $user ) {
    675675                return false;
    676676        }
    function wp_list_users( $args = array() ) {  
    843843        $users = get_users( $query_args );
    844844
    845845        foreach ( $users as $user_id ) {
    846                 $user = get_userdata( $user_id );
     846                $user = get_user( $user_id );
    847847
    848848                if ( $parsed_args['exclude_admin'] && 'admin' === $user->display_name ) {
    849849                        continue;
    function is_user_member_of_blog( $user_id = 0, $blog_id = 0 ) {  
    10721072        if ( empty( $user_id ) ) {
    10731073                return false;
    10741074        } else {
    1075                 $user = get_userdata( $user_id );
     1075                $user = get_user( $user_id );
    10761076                if ( ! $user instanceof WP_User ) {
    10771077                        return false;
    10781078                }
    function setup_userdata( $for_user_id = 0 ) {  
    15051505        if ( ! $for_user_id ) {
    15061506                $for_user_id = get_current_user_id();
    15071507        }
    1508         $user = get_userdata( $for_user_id );
     1508        $user = get_user( $for_user_id );
    15091509
    15101510        if ( ! $user ) {
    15111511                $user_ID       = 0;
    function wp_dropdown_users( $args = '' ) {  
    16981698                        }
    16991699
    17001700                        if ( ! $found_selected ) {
    1701                                 $selected_user = get_userdata( $parsed_args['selected'] );
     1701                                $selected_user = get_user( $parsed_args['selected'] );
    17021702                                if ( $selected_user ) {
    17031703                                        $users[] = $selected_user;
    17041704                                }
    function wp_insert_user( $userdata ) {  
    20892089        if ( ! empty( $userdata['ID'] ) ) {
    20902090                $user_id       = (int) $userdata['ID'];
    20912091                $update        = true;
    2092                 $old_user_data = get_userdata( $user_id );
     2092                $old_user_data = get_user( $user_id );
    20932093
    20942094                if ( ! $old_user_data ) {
    20952095                        return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
    function wp_update_user( $userdata ) {  
    25382538        }
    25392539
    25402540        // First, get all of the original fields.
    2541         $user_obj = get_userdata( $user_id );
     2541        $user_obj = get_user( $user_id );
    25422542        if ( ! $user_obj ) {
    25432543                return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
    25442544        }
    function wp_is_application_passwords_available_for_user( $user ) {  
    49734973        }
    49744974
    49754975        if ( ! is_object( $user ) ) {
    4976                 $user = get_userdata( $user );
     4976                $user = get_user( $user );
    49774977        }
    49784978
    49794979        if ( ! $user || ! $user->exists() ) {
    function wp_cache_set_users_last_changed() {  
    50575057 */
    50585058function wp_is_password_reset_allowed_for_user( $user ) {
    50595059        if ( ! is_object( $user ) ) {
    5060                 $user = get_userdata( $user );
     5060                $user = get_user( $user );
    50615061        }
    50625062
    50635063        if ( ! $user || ! $user->exists() ) {