-
diff --git a/src/wp-activate.php b/src/wp-activate.php
index 36772a2d9d..70cf4dfb84 100644
|
a
|
b
|
$blog_details = get_site();
|
| 175 | 175 | <?php |
| 176 | 176 | } else { |
| 177 | 177 | $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'] ); |
| 179 | 179 | ?> |
| 180 | 180 | <h2><?php _e( 'Your account is now active!' ); ?></h2> |
| 181 | 181 | |
-
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' ) ) {
|
| 647 | 647 | <?php |
| 648 | 648 | if ( 'auto-draft' !== $post->post_status ) { |
| 649 | 649 | 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 ) ); |
| 651 | 651 | if ( $last_user ) { |
| 652 | 652 | printf( |
| 653 | 653 | /* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time. */ |
-
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 ) {
|
| 154 | 154 | |
| 155 | 155 | $user_details = null; |
| 156 | 156 | if ( $locked ) { |
| 157 | | $user = get_userdata( $user_id ); |
| | 157 | $user = get_user( $user_id ); |
| 158 | 158 | $user_details = array( |
| 159 | 159 | 'avatar' => get_avatar_url( $user_id, array( 'size' => 128 ) ), |
| 160 | 160 | 'name' => $user->display_name, |
-
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 ) {
|
| 1759 | 1759 | $x->send(); |
| 1760 | 1760 | } |
| 1761 | 1761 | |
| 1762 | | $user_object = get_userdata( $user_id ); |
| | 1762 | $user_object = get_user( $user_id ); |
| 1763 | 1763 | $wp_list_table = _get_list_table( 'WP_Users_List_Table' ); |
| 1764 | 1764 | |
| 1765 | 1765 | $role = current( $user_object->roles ); |
| … |
… |
function wp_ajax_inline_save() {
|
| 2074 | 2074 | |
| 2075 | 2075 | $last = wp_check_post_lock( $post_id ); |
| 2076 | 2076 | if ( $last ) { |
| 2077 | | $last_user = get_userdata( $last ); |
| | 2077 | $last_user = get_user( $last ); |
| 2078 | 2078 | $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' ); |
| 2079 | 2079 | |
| 2080 | 2080 | /* translators: %s: User's display name. */ |
| … |
… |
function wp_ajax_wp_fullscreen_save_post() {
|
| 2890 | 2890 | |
| 2891 | 2891 | $last_id = get_post_meta( $post_id, '_edit_last', true ); |
| 2892 | 2892 | if ( $last_id ) { |
| 2893 | | $last_user = get_userdata( $last_id ); |
| | 2893 | $last_user = get_user( $last_id ); |
| 2894 | 2894 | /* translators: 1: User's display name, 2: Date of last edit, 3: Time of last edit. */ |
| 2895 | 2895 | $last_edited = sprintf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), $last_date, $last_time ); |
| 2896 | 2896 | } else { |
| … |
… |
function wp_ajax_parse_media_shortcode() {
|
| 3964 | 3964 | * @since 4.1.0 |
| 3965 | 3965 | */ |
| 3966 | 3966 | function wp_ajax_destroy_sessions() { |
| 3967 | | $user = get_userdata( (int) $_POST['user_id'] ); |
| | 3967 | $user = get_user( (int) $_POST['user_id'] ); |
| 3968 | 3968 | |
| 3969 | 3969 | if ( $user ) { |
| 3970 | 3970 | if ( ! current_user_can( 'edit_user', $user->ID ) ) { |
| … |
… |
function wp_ajax_send_password_reset() {
|
| 5603 | 5603 | } |
| 5604 | 5604 | |
| 5605 | 5605 | // Send the password reset link. |
| 5606 | | $user = get_userdata( $user_id ); |
| | 5606 | $user = get_user( $user_id ); |
| 5607 | 5607 | $results = retrieve_password( $user->user_login ); |
| 5608 | 5608 | |
| 5609 | 5609 | if ( true === $results ) { |
-
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 {
|
| 1115 | 1115 | $lock_holder = wp_check_post_lock( $post->ID ); |
| 1116 | 1116 | |
| 1117 | 1117 | if ( $lock_holder ) { |
| 1118 | | $lock_holder = get_userdata( $lock_holder ); |
| | 1118 | $lock_holder = get_user( $lock_holder ); |
| 1119 | 1119 | $locked_avatar = get_avatar( $lock_holder->ID, 18 ); |
| 1120 | 1120 | /* translators: %s: User's display name. */ |
| 1121 | 1121 | $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) ); |
-
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 {
|
| 432 | 432 | */ |
| 433 | 433 | public function single_row( $user_object, $style = '', $role = '', $numposts = 0 ) { |
| 434 | 434 | if ( ! ( $user_object instanceof WP_User ) ) { |
| 435 | | $user_object = get_userdata( (int) $user_object ); |
| | 435 | $user_object = get_user( (int) $user_object ); |
| 436 | 436 | } |
| 437 | 437 | $user_object->filter = 'display'; |
| 438 | 438 | $email = $user_object->user_email; |
-
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
|
| 286 | 286 | |
| 287 | 287 | global $wpdb; |
| 288 | 288 | |
| 289 | | if ( ! $user = get_userdata( $user_id ) ) |
| | 289 | if ( ! $user = get_user( $user_id ) ) |
| 290 | 290 | return array(); |
| 291 | 291 | $post_type_obj = get_post_type_object($post_type); |
| 292 | 292 | |
-
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() ) {
|
| 368 | 368 | $authors = array(); |
| 369 | 369 | $results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and" ); |
| 370 | 370 | foreach ( (array) $results as $result ) { |
| 371 | | $authors[] = get_userdata( $result->post_author ); |
| | 371 | $authors[] = get_user( $result->post_author ); |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | $authors = array_filter( $authors ); |
-
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 ) {
|
| 1148 | 1148 | $user_id = wp_check_post_lock( $post_id ); |
| 1149 | 1149 | |
| 1150 | 1150 | if ( $user_id ) { |
| 1151 | | $user = get_userdata( $user_id ); |
| | 1151 | $user = get_user( $user_id ); |
| 1152 | 1152 | |
| 1153 | 1153 | if ( $user && current_user_can( 'edit_post', $post_id ) ) { |
| 1154 | 1154 | $send = array( |
| … |
… |
function wp_refresh_post_lock( $response, $data, $screen_id ) {
|
| 1201 | 1201 | } |
| 1202 | 1202 | |
| 1203 | 1203 | $user_id = wp_check_post_lock( $post_id ); |
| 1204 | | $user = get_userdata( $user_id ); |
| | 1204 | $user = get_user( $user_id ); |
| 1205 | 1205 | |
| 1206 | 1206 | if ( $user ) { |
| 1207 | 1207 | $error = array( |
-
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 ) {
|
| 330 | 330 | function refresh_user_details( $id ) { |
| 331 | 331 | $id = (int) $id; |
| 332 | 332 | |
| 333 | | $user = get_userdata( $id ); |
| | 333 | $user = get_user( $id ); |
| 334 | 334 | if ( ! $user ) { |
| 335 | 335 | return false; |
| 336 | 336 | } |
| … |
… |
function confirm_delete_users( $users ) {
|
| 883 | 883 | $allusers = (array) $_POST['allusers']; |
| 884 | 884 | foreach ( $allusers as $user_id ) { |
| 885 | 885 | if ( '' !== $user_id && '0' !== $user_id ) { |
| 886 | | $delete_user = get_userdata( $user_id ); |
| | 886 | $delete_user = get_user( $user_id ); |
| 887 | 887 | |
| 888 | 888 | if ( ! current_user_can( 'delete_user', $delete_user->ID ) ) { |
| 889 | 889 | wp_die( |
-
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 ) {
|
| 1700 | 1700 | $time = $lock[0]; |
| 1701 | 1701 | $user = isset( $lock[1] ) ? $lock[1] : get_post_meta( $post->ID, '_edit_last', true ); |
| 1702 | 1702 | |
| 1703 | | if ( ! get_userdata( $user ) ) { |
| | 1703 | if ( ! get_user( $user ) ) { |
| 1704 | 1704 | return false; |
| 1705 | 1705 | } |
| 1706 | 1706 | |
| … |
… |
function _admin_notice_post_locked() {
|
| 1765 | 1765 | $user_id = wp_check_post_lock( $post->ID ); |
| 1766 | 1766 | |
| 1767 | 1767 | if ( $user_id ) { |
| 1768 | | $user = get_userdata( $user_id ); |
| | 1768 | $user = get_user( $user_id ); |
| 1769 | 1769 | } |
| 1770 | 1770 | |
| 1771 | 1771 | if ( $user ) { |
-
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 ) {
|
| 34 | 34 | if ( $user_id ) { |
| 35 | 35 | $update = true; |
| 36 | 36 | $user->ID = $user_id; |
| 37 | | $userdata = get_userdata( $user_id ); |
| | 37 | $userdata = get_user( $user_id ); |
| 38 | 38 | $user->user_login = wp_slash( $userdata->user_login ); |
| 39 | 39 | } else { |
| 40 | 40 | $update = false; |
| … |
… |
function get_editable_roles() {
|
| 289 | 289 | * @return WP_User|false WP_User object on success, false on failure. |
| 290 | 290 | */ |
| 291 | 291 | function get_user_to_edit( $user_id ) { |
| 292 | | $user = get_userdata( $user_id ); |
| | 292 | $user = get_user( $user_id ); |
| 293 | 293 | |
| 294 | 294 | if ( $user ) { |
| 295 | 295 | $user->filter = 'edit'; |
| … |
… |
function default_password_nag_edit_user( $user_ID, $old_data ) {
|
| 514 | 514 | return; |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | | $new_data = get_userdata( $user_ID ); |
| | 517 | $new_data = get_user( $user_ID ); |
| 518 | 518 | |
| 519 | 519 | // Remove the nag if the password has been changed. |
| 520 | 520 | if ( $new_data->user_pass !== $old_data->user_pass ) { |
-
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 ) {
|
| 161 | 161 | ); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | | $user = get_userdata( $user_id ); |
| | 164 | $user = get_user( $user_id ); |
| 165 | 165 | $user->set_role( $role ); |
| 166 | 166 | } |
| 167 | 167 | } else { |
-
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'] ) ) {
|
| 79 | 79 | exit; |
| 80 | 80 | |
| 81 | 81 | case 'spam': |
| 82 | | $user = get_userdata( $user_id ); |
| | 82 | $user = get_user( $user_id ); |
| 83 | 83 | if ( is_super_admin( $user->ID ) ) { |
| 84 | 84 | wp_die( |
| 85 | 85 | sprintf( |
| … |
… |
if ( isset( $_GET['action'] ) ) {
|
| 106 | 106 | break; |
| 107 | 107 | |
| 108 | 108 | case 'notspam': |
| 109 | | $user = get_userdata( $user_id ); |
| | 109 | $user = get_user( $user_id ); |
| 110 | 110 | |
| 111 | 111 | $userfunction = 'all_notspam'; |
| 112 | 112 | $blogs = get_blogs_of_user( $user_id, true ); |
-
diff --git a/src/wp-admin/post.php b/src/wp-admin/post.php
index 17875cb3e5..f44102262b 100644
|
a
|
b
|
switch ( $action ) {
|
| 252 | 252 | |
| 253 | 253 | $user_id = wp_check_post_lock( $post_id ); |
| 254 | 254 | if ( $user_id ) { |
| 255 | | $user = get_userdata( $user_id ); |
| | 255 | $user = get_user( $user_id ); |
| 256 | 256 | /* translators: %s: User's display name. */ |
| 257 | 257 | wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) ); |
| 258 | 258 | } |
-
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 ) {
|
| 25 | 25 | $user_id = $current_user->ID; |
| 26 | 26 | } elseif ( ! $user_id && ! IS_PROFILE_PAGE ) { |
| 27 | 27 | wp_die( __( 'Invalid user ID.' ) ); |
| 28 | | } elseif ( ! get_userdata( $user_id ) ) { |
| | 28 | } elseif ( ! get_user( $user_id ) ) { |
| 29 | 29 | wp_die( __( 'Invalid user ID.' ) ); |
| 30 | 30 | } |
| 31 | 31 | |
| … |
… |
switch ( $action ) {
|
| 159 | 159 | |
| 160 | 160 | // Update the email address in signups, if present. |
| 161 | 161 | if ( is_multisite() ) { |
| 162 | | $user = get_userdata( $user_id ); |
| | 162 | $user = get_user( $user_id ); |
| 163 | 163 | |
| 164 | 164 | 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 ) ) ) { |
| 165 | 165 | $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $_POST['email'], $user_login ) ); |
-
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() ) {
|
| 161 | 161 | ); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | | $user = get_userdata( $id ); |
| | 164 | $user = get_user( $id ); |
| 165 | 165 | $user->set_role( $role ); |
| 166 | 166 | } |
| 167 | 167 | |
| … |
… |
switch ( $wp_list_table->current_action() ) {
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | // Send the password reset link. |
| 258 | | $user = get_userdata( $id ); |
| | 258 | $user = get_user( $id ); |
| 259 | 259 | if ( true === retrieve_password( $user->user_login ) ) { |
| 260 | 260 | ++$reset_count; |
| 261 | 261 | } |
| … |
… |
switch ( $wp_list_table->current_action() ) {
|
| 361 | 361 | $go_delete = 0; |
| 362 | 362 | |
| 363 | 363 | foreach ( $all_user_ids as $id ) { |
| 364 | | $user = get_userdata( $id ); |
| | 364 | $user = get_user( $id ); |
| 365 | 365 | |
| 366 | 366 | if ( $id === $current_user->ID ) { |
| 367 | 367 | echo '<li>'; |
| … |
… |
switch ( $wp_list_table->current_action() ) {
|
| 528 | 528 | $go_remove = false; |
| 529 | 529 | |
| 530 | 530 | foreach ( $user_ids as $id ) { |
| 531 | | $user = get_userdata( $id ); |
| | 531 | $user = get_user( $id ); |
| 532 | 532 | |
| 533 | 533 | if ( ! current_user_can( 'remove_user', $id ) ) { |
| 534 | 534 | echo '<li>'; |
-
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() {
|
| 35 | 35 | */ |
| 36 | 36 | function twentynineteen_is_comment_by_post_author( $comment = null ) { |
| 37 | 37 | if ( is_object( $comment ) && $comment->user_id > 0 ) { |
| 38 | | $user = get_userdata( $comment->user_id ); |
| | 38 | $user = get_user( $comment->user_id ); |
| 39 | 39 | $post = get_post( $comment->comment_post_ID ); |
| 40 | 40 | if ( ! empty( $user ) && ! empty( $post ) ) { |
| 41 | 41 | return $comment->user_id === $post->post_author; |
-
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 ) {
|
| 143 | 143 | |
| 144 | 144 | if ( is_object( $comment ) && $comment->user_id > 0 ) { |
| 145 | 145 | |
| 146 | | $user = get_userdata( $comment->user_id ); |
| | 146 | $user = get_user( $comment->user_id ); |
| 147 | 147 | $post = get_post( $comment->comment_post_ID ); |
| 148 | 148 | |
| 149 | 149 | if ( ! empty( $user ) && ! empty( $post ) ) { |
-
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 ) {
|
| 873 | 873 | ); |
| 874 | 874 | } |
| 875 | 875 | } elseif ( 'user-edit' === $current_screen->base && isset( $user_id ) ) { |
| 876 | | $user_object = get_userdata( $user_id ); |
| | 876 | $user_object = get_user( $user_id ); |
| 877 | 877 | $view_link = get_author_posts_url( $user_object->ID ); |
| 878 | 878 | if ( $user_object->exists() && $view_link ) { |
| 879 | 879 | $wp_admin_bar->add_node( |
-
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() {
|
| 93 | 93 | $last_id = get_post_meta( get_post()->ID, '_edit_last', true ); |
| 94 | 94 | |
| 95 | 95 | if ( $last_id ) { |
| 96 | | $last_user = get_userdata( $last_id ); |
| | 96 | $last_user = get_user( $last_id ); |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * Filters the display name of the author who last edited the current post. |
| … |
… |
function get_the_author_meta( $field = '', $user_id = false ) {
|
| 166 | 166 | global $authordata; |
| 167 | 167 | $user_id = isset( $authordata->ID ) ? $authordata->ID : 0; |
| 168 | 168 | } else { |
| 169 | | $authordata = get_userdata( $user_id ); |
| | 169 | $authordata = get_user( $user_id ); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | if ( in_array( $field, array( 'login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status' ), true ) ) { |
| … |
… |
function get_author_posts_url( $author_id, $author_nicename = '' ) {
|
| 372 | 372 | $link = $file . '?author=' . $author_id; |
| 373 | 373 | } else { |
| 374 | 374 | if ( '' === $author_nicename ) { |
| 375 | | $user = get_userdata( $author_id ); |
| | 375 | $user = get_user( $author_id ); |
| 376 | 376 | if ( ! empty( $user->user_nicename ) ) { |
| 377 | 377 | $author_nicename = $user->user_nicename; |
| 378 | 378 | } |
| … |
… |
function wp_list_authors( $args = '' ) {
|
| 503 | 503 | continue; |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | | $author = get_userdata( $author_id ); |
| | 506 | $author = get_user( $author_id ); |
| 507 | 507 | |
| 508 | 508 | if ( $parsed_args['exclude_admin'] && 'admin' === $author->display_name ) { |
| 509 | 509 | continue; |
-
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 ) {
|
| 319 | 319 | } elseif ( is_author() && ! empty( $_GET['author'] ) |
| 320 | 320 | && is_string( $_GET['author'] ) && preg_match( '|^[0-9]+$|', $_GET['author'] ) |
| 321 | 321 | ) { |
| 322 | | $author = get_userdata( get_query_var( 'author' ) ); |
| | 322 | $author = get_user( get_query_var( 'author' ) ); |
| 323 | 323 | |
| 324 | 324 | if ( false !== $author |
| 325 | 325 | && $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 ) ) |
-
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 ) {
|
| 940 | 940 | return false; |
| 941 | 941 | } |
| 942 | 942 | |
| 943 | | $author = get_userdata( $post->post_author ); |
| | 943 | $author = get_user( $post->post_author ); |
| 944 | 944 | |
| 945 | 945 | if ( ! $author ) { |
| 946 | 946 | return false; |
| … |
… |
function author_can( $post, $capability, ...$args ) {
|
| 973 | 973 | */ |
| 974 | 974 | function user_can( $user, $capability, ...$args ) { |
| 975 | 975 | if ( ! is_object( $user ) ) { |
| 976 | | $user = get_userdata( $user ); |
| | 976 | $user = get_user( $user ); |
| 977 | 977 | } |
| 978 | 978 | |
| 979 | 979 | if ( empty( $user ) ) { |
| … |
… |
function is_super_admin( $user_id = false ) {
|
| 1076 | 1076 | if ( ! $user_id ) { |
| 1077 | 1077 | $user = wp_get_current_user(); |
| 1078 | 1078 | } else { |
| 1079 | | $user = get_userdata( $user_id ); |
| | 1079 | $user = get_user( $user_id ); |
| 1080 | 1080 | } |
| 1081 | 1081 | |
| 1082 | 1082 | if ( ! $user || ! $user->exists() ) { |
| … |
… |
function grant_super_admin( $user_id ) {
|
| 1126 | 1126 | // Directly fetch site_admins instead of using get_super_admins(). |
| 1127 | 1127 | $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); |
| 1128 | 1128 | |
| 1129 | | $user = get_userdata( $user_id ); |
| | 1129 | $user = get_user( $user_id ); |
| 1130 | 1130 | if ( $user && ! in_array( $user->user_login, $super_admins, true ) ) { |
| 1131 | 1131 | $super_admins[] = $user->user_login; |
| 1132 | 1132 | update_site_option( 'site_admins', $super_admins ); |
| … |
… |
function revoke_super_admin( $user_id ) {
|
| 1173 | 1173 | // Directly fetch site_admins instead of using get_super_admins(). |
| 1174 | 1174 | $super_admins = get_site_option( 'site_admins', array( 'admin' ) ); |
| 1175 | 1175 | |
| 1176 | | $user = get_userdata( $user_id ); |
| | 1176 | $user = get_user( $user_id ); |
| 1177 | 1177 | if ( $user && 0 !== strcasecmp( $user->user_email, get_site_option( 'admin_email' ) ) ) { |
| 1178 | 1178 | $key = array_search( $user->user_login, $super_admins, true ); |
| 1179 | 1179 | if ( false !== $key ) { |
-
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 {
|
| 3323 | 3323 | return null; |
| 3324 | 3324 | } |
| 3325 | 3325 | |
| 3326 | | $lock_user = get_userdata( $user_id ); |
| | 3326 | $lock_user = get_user( $user_id ); |
| 3327 | 3327 | |
| 3328 | 3328 | if ( ! $lock_user ) { |
| 3329 | 3329 | return null; |
-
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 {
|
| 3917 | 3917 | } |
| 3918 | 3918 | } |
| 3919 | 3919 | |
| 3920 | | $this->queried_object = get_userdata( $this->queried_object_id ); |
| | 3920 | $this->queried_object = get_user( $this->queried_object_id ); |
| 3921 | 3921 | } |
| 3922 | 3922 | |
| 3923 | 3923 | return $this->queried_object; |
| … |
… |
class WP_Query {
|
| 4749 | 4749 | |
| 4750 | 4750 | $id = (int) $post->ID; |
| 4751 | 4751 | |
| 4752 | | $authordata = get_userdata( $post->post_author ); |
| | 4752 | $authordata = get_user( $post->post_author ); |
| 4753 | 4753 | |
| 4754 | 4754 | $currentday = false; |
| 4755 | 4755 | $currentmonth = false; |
-
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 {
|
| 1124 | 1124 | } |
| 1125 | 1125 | |
| 1126 | 1126 | // Get the author info. |
| 1127 | | $author = get_userdata( $page->post_author ); |
| | 1127 | $author = get_user( $page->post_author ); |
| 1128 | 1128 | |
| 1129 | 1129 | $page_template = get_page_template_slug( $page->ID ); |
| 1130 | 1130 | if ( empty( $page_template ) ) { |
| … |
… |
class wp_xmlrpc_server extends IXR_Server {
|
| 1493 | 1493 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to create posts as this user.' ) ); |
| 1494 | 1494 | } |
| 1495 | 1495 | |
| 1496 | | $author = get_userdata( $post_data['post_author'] ); |
| | 1496 | $author = get_user( $post_data['post_author'] ); |
| 1497 | 1497 | |
| 1498 | 1498 | if ( ! $author ) { |
| 1499 | 1499 | return new IXR_Error( 404, __( 'Invalid author ID.' ) ); |
| … |
… |
class wp_xmlrpc_server extends IXR_Server {
|
| 2649 | 2649 | * names can be used to specify multiple fields. The available conceptual |
| 2650 | 2650 | * groups are 'basic' and 'all'. |
| 2651 | 2651 | * |
| 2652 | | * @uses get_userdata() |
| | 2652 | * @uses get_user() |
| 2653 | 2653 | * |
| 2654 | 2654 | * @param array $args { |
| 2655 | 2655 | * Method arguments. Note: arguments must be ordered as documented. |
| … |
… |
class wp_xmlrpc_server extends IXR_Server {
|
| 2711 | 2711 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this user.' ) ); |
| 2712 | 2712 | } |
| 2713 | 2713 | |
| 2714 | | $user_data = get_userdata( $user_id ); |
| | 2714 | $user_data = get_user( $user_id ); |
| 2715 | 2715 | |
| 2716 | 2716 | if ( ! $user_data ) { |
| 2717 | 2717 | return new IXR_Error( 404, __( 'Invalid user ID.' ) ); |
| … |
… |
class wp_xmlrpc_server extends IXR_Server {
|
| 2813 | 2813 | /** |
| 2814 | 2814 | * Retrieves information about the requesting user. |
| 2815 | 2815 | * |
| 2816 | | * @uses get_userdata() |
| | 2816 | * @uses get_user() |
| 2817 | 2817 | * |
| 2818 | 2818 | * @param array $args { |
| 2819 | 2819 | * Method arguments. Note: arguments must be ordered as documented. |
| … |
… |
class wp_xmlrpc_server extends IXR_Server {
|
| 2854 | 2854 | return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit your profile.' ) ); |
| 2855 | 2855 | } |
| 2856 | 2856 | |
| 2857 | | $user_data = get_userdata( $user->ID ); |
| | 2857 | $user_data = get_user( $user->ID ); |
| 2858 | 2858 | |
| 2859 | 2859 | return $this->_prepare_user( $user_data, $fields ); |
| 2860 | 2860 | } |
| … |
… |
class wp_xmlrpc_server extends IXR_Server {
|
| 5464 | 5464 | default: |
| 5465 | 5465 | return new IXR_Error( 401, __( 'Invalid post type.' ) ); |
| 5466 | 5466 | } |
| 5467 | | $author = get_userdata( $content_struct['wp_author_id'] ); |
| | 5467 | $author = get_user( $content_struct['wp_author_id'] ); |
| 5468 | 5468 | if ( ! $author ) { |
| 5469 | 5469 | return new IXR_Error( 404, __( 'Invalid author ID.' ) ); |
| 5470 | 5470 | } |
| … |
… |
class wp_xmlrpc_server extends IXR_Server {
|
| 6106 | 6106 | $link = get_permalink( $postdata['ID'] ); |
| 6107 | 6107 | |
| 6108 | 6108 | // Get the author info. |
| 6109 | | $author = get_userdata( $postdata['post_author'] ); |
| | 6109 | $author = get_user( $postdata['post_author'] ); |
| 6110 | 6110 | |
| 6111 | 6111 | $allow_comments = ( 'open' === $postdata['comment_status'] ) ? 1 : 0; |
| 6112 | 6112 | $allow_pings = ( 'open' === $postdata['ping_status'] ) ? 1 : 0; |
| … |
… |
class wp_xmlrpc_server extends IXR_Server {
|
| 6258 | 6258 | $link = get_permalink( $entry['ID'] ); |
| 6259 | 6259 | |
| 6260 | 6260 | // Get the post author info. |
| 6261 | | $author = get_userdata( $entry['post_author'] ); |
| | 6261 | $author = get_user( $entry['post_author'] ); |
| 6262 | 6262 | |
| 6263 | 6263 | $allow_comments = ( 'open' === $entry['comment_status'] ) ? 1 : 0; |
| 6264 | 6264 | $allow_pings = ( 'open' === $entry['ping_status'] ) ? 1 : 0; |
-
diff --git a/src/wp-includes/class-wp.php b/src/wp-includes/class-wp.php
index ce88c102cf..0213beeb2f 100644
|
a
|
b
|
class WP {
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | if ( $wp_query->is_author() ) { |
| 673 | | $GLOBALS['authordata'] = get_userdata( get_queried_object_id() ); |
| | 673 | $GLOBALS['authordata'] = get_user( get_queried_object_id() ); |
| 674 | 674 | } |
| 675 | 675 | } |
| 676 | 676 | |
-
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 ) {
|
| 27 | 27 | $comment_id = ! empty( $comment->comment_ID ) ? $comment->comment_ID : $comment_id; |
| 28 | 28 | |
| 29 | 29 | 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; |
| 31 | 31 | if ( $user ) { |
| 32 | 32 | $comment_author = $user->display_name; |
| 33 | 33 | } else { |
| … |
… |
function get_comment_class( $css_class = '', $comment_id = null, $post = null )
|
| 519 | 519 | $classes[] = ( empty( $comment->comment_type ) ) ? 'comment' : $comment->comment_type; |
| 520 | 520 | |
| 521 | 521 | // 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; |
| 523 | 523 | if ( $user ) { |
| 524 | 524 | $classes[] = 'byuser'; |
| 525 | 525 | $classes[] = 'comment-author-' . sanitize_html_class( $user->user_nicename, $comment->user_id ); |
-
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 ) {
|
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | if ( ! empty( $commentdata['user_id'] ) ) { |
| 775 | | $user = get_userdata( $commentdata['user_id'] ); |
| | 775 | $user = get_user( $commentdata['user_id'] ); |
| 776 | 776 | $post_author = $wpdb->get_var( |
| 777 | 777 | $wpdb->prepare( |
| 778 | 778 | "SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1", |
-
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=
|
| 206 | 206 | function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') { |
| 207 | 207 | _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
| 208 | 208 | |
| 209 | | $author_data = get_userdata($user_id); |
| | 209 | $author_data = get_user($user_id); |
| 210 | 210 | return ($author_data->user_level > 1); |
| 211 | 211 | } |
| 212 | 212 | |
| … |
… |
function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') {
|
| 225 | 225 | function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') { |
| 226 | 226 | _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
| 227 | 227 | |
| 228 | | $author_data = get_userdata($user_id); |
| | 228 | $author_data = get_user($user_id); |
| 229 | 229 | return ($author_data->user_level >= 1); |
| 230 | 230 | } |
| 231 | 231 | |
| … |
… |
function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {
|
| 244 | 244 | function user_can_edit_post($user_id, $post_id, $blog_id = 1) { |
| 245 | 245 | _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
| 246 | 246 | |
| 247 | | $author_data = get_userdata($user_id); |
| | 247 | $author_data = get_user($user_id); |
| 248 | 248 | $post = get_post($post_id); |
| 249 | | $post_author_data = get_userdata($post->post_author); |
| | 249 | $post_author_data = get_user($post->post_author); |
| 250 | 250 | |
| 251 | 251 | if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2)) |
| 252 | 252 | || ($author_data->user_level > $post_author_data->user_level) |
| … |
… |
function user_can_delete_post($user_id, $post_id, $blog_id = 1) {
|
| 291 | 291 | function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') { |
| 292 | 292 | _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
| 293 | 293 | |
| 294 | | $author_data = get_userdata($user_id); |
| | 294 | $author_data = get_user($user_id); |
| 295 | 295 | return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id)); |
| 296 | 296 | } |
| 297 | 297 | |
| … |
… |
function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
|
| 310 | 310 | function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) { |
| 311 | 311 | _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
| 312 | 312 | |
| 313 | | $author_data = get_userdata($user_id); |
| | 313 | $author_data = get_user($user_id); |
| 314 | 314 | return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id)); |
| 315 | 315 | } |
| 316 | 316 | |
| … |
… |
function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
|
| 366 | 366 | function user_can_edit_user($user_id, $other_user) { |
| 367 | 367 | _deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' ); |
| 368 | 368 | |
| 369 | | $user = get_userdata($user_id); |
| 370 | | $other = get_userdata($other_user); |
| | 369 | $user = get_user($user_id); |
| | 370 | $other = get_user($other_user); |
| 371 | 371 | if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID ) |
| 372 | 372 | return true; |
| 373 | 373 | else |
-
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 ) {
|
| 589 | 589 | 'type' => 'link', |
| 590 | 590 | ); |
| 591 | 591 | |
| 592 | | $author = get_userdata( $post->post_author ); |
| | 592 | $author = get_user( $post->post_author ); |
| 593 | 593 | |
| 594 | 594 | if ( $author ) { |
| 595 | 595 | $data['author_name'] = $author->display_name; |
-
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 ) {
|
| 263 | 263 | |
| 264 | 264 | $author = ''; |
| 265 | 265 | if ( str_contains( $permalink, '%author%' ) ) { |
| 266 | | $authordata = get_userdata( $post->post_author ); |
| | 266 | $authordata = get_user( $post->post_author ); |
| 267 | 267 | $author = $authordata->user_nicename; |
| 268 | 268 | } |
| 269 | 269 | |
| … |
… |
function get_edit_user_link( $user_id = null ) {
|
| 1731 | 1731 | return ''; |
| 1732 | 1732 | } |
| 1733 | 1733 | |
| 1734 | | $user = get_userdata( $user_id ); |
| | 1734 | $user = get_user( $user_id ); |
| 1735 | 1735 | |
| 1736 | 1736 | if ( ! $user ) { |
| 1737 | 1737 | return ''; |
-
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 ) {
|
| 152 | 152 | function add_user_to_blog( $blog_id, $user_id, $role ) { |
| 153 | 153 | switch_to_blog( $blog_id ); |
| 154 | 154 | |
| 155 | | $user = get_userdata( $user_id ); |
| | 155 | $user = get_user( $user_id ); |
| 156 | 156 | |
| 157 | 157 | if ( ! $user ) { |
| 158 | 158 | restore_current_blog(); |
| … |
… |
function remove_user_from_blog( $user_id, $blog_id = 0, $reassign = 0 ) {
|
| 267 | 267 | update_user_meta( $user_id, 'source_domain', $new_domain ); |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | | $user = get_userdata( $user_id ); |
| | 270 | $user = get_user( $user_id ); |
| 271 | 271 | if ( ! $user ) { |
| 272 | 272 | restore_current_blog(); |
| 273 | 273 | return new WP_Error( 'user_does_not_exist', __( 'That user does not exist.' ) ); |
| … |
… |
function newuser_notify_siteadmin( $user_id ) {
|
| 1498 | 1498 | return false; |
| 1499 | 1499 | } |
| 1500 | 1500 | |
| 1501 | | $user = get_userdata( $user_id ); |
| | 1501 | $user = get_user( $user_id ); |
| 1502 | 1502 | |
| 1503 | 1503 | $options_site_url = esc_url( network_admin_url( 'settings.php' ) ); |
| 1504 | 1504 | |
| … |
… |
function wpmu_welcome_notification( $blog_id, $user_id, $password, $title, $meta
|
| 1615 | 1615 | return false; |
| 1616 | 1616 | } |
| 1617 | 1617 | |
| 1618 | | $user = get_userdata( $user_id ); |
| | 1618 | $user = get_user( $user_id ); |
| 1619 | 1619 | |
| 1620 | 1620 | $switched_locale = switch_to_user_locale( $user_id ); |
| 1621 | 1621 | |
| … |
… |
We hope you enjoy your new site. Thanks!
|
| 1714 | 1714 | */ |
| 1715 | 1715 | function wpmu_new_site_admin_notification( $site_id, $user_id ) { |
| 1716 | 1716 | $site = get_site( $site_id ); |
| 1717 | | $user = get_userdata( $user_id ); |
| | 1717 | $user = get_user( $user_id ); |
| 1718 | 1718 | $email = get_site_option( 'admin_email' ); |
| 1719 | 1719 | |
| 1720 | 1720 | if ( ! $site || ! $user || ! $email ) { |
| … |
… |
function wpmu_welcome_user_notification( $user_id, $password, $meta = array() )
|
| 1848 | 1848 | |
| 1849 | 1849 | $welcome_email = get_site_option( 'welcome_user_email' ); |
| 1850 | 1850 | |
| 1851 | | $user = get_userdata( $user_id ); |
| | 1851 | $user = get_user( $user_id ); |
| 1852 | 1852 | |
| 1853 | 1853 | $switched_locale = switch_to_user_locale( $user_id ); |
| 1854 | 1854 | |
| … |
… |
function wpmu_log_new_registrations( $blog_id, $user_id ) {
|
| 2046 | 2046 | $user_id = ! empty( $user_id['user_id'] ) ? $user_id['user_id'] : 0; |
| 2047 | 2047 | } |
| 2048 | 2048 | |
| 2049 | | $user = get_userdata( (int) $user_id ); |
| | 2049 | $user = get_user( (int) $user_id ); |
| 2050 | 2050 | if ( $user ) { |
| 2051 | 2051 | $wpdb->insert( |
| 2052 | 2052 | $wpdb->registration_log, |
-
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' ) ) :
|
| 71 | 71 | } |
| 72 | 72 | endif; |
| 73 | 73 | |
| 74 | | if ( ! function_exists( 'get_userdata' ) ) : |
| 75 | | /** |
| | 74 | if ( ! function_exists( 'get_user' ) ) : |
| | 75 | /* |
| 76 | 76 | * Retrieves user info by user ID. |
| 77 | 77 | * |
| 78 | 78 | * @since 0.71 |
| … |
… |
if ( ! function_exists( 'get_userdata' ) ) :
|
| 80 | 80 | * @param int $user_id User ID |
| 81 | 81 | * @return WP_User|false WP_User object on success, false on failure. |
| 82 | 82 | */ |
| 83 | | function get_userdata( $user_id ) { |
| | 83 | function get_user( $user_id ) { // get_userdata() |
| 84 | 84 | return get_user_by( 'id', $user_id ); |
| 85 | 85 | } |
| 86 | 86 | endif; |
| … |
… |
endif;
|
| 114 | 114 | |
| 115 | 115 | if ( ! function_exists( 'cache_users' ) ) : |
| 116 | 116 | /** |
| 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(). |
| 118 | 118 | * |
| 119 | 119 | * @since 3.0.0 |
| 120 | 120 | * |
| … |
… |
if ( ! function_exists( 'wp_generate_auth_cookie' ) ) :
|
| 855 | 855 | * @return string Authentication cookie contents. Empty string if user does not exist. |
| 856 | 856 | */ |
| 857 | 857 | function wp_generate_auth_cookie( $user_id, $expiration, $scheme = 'auth', $token = '' ) { |
| 858 | | $user = get_userdata( $user_id ); |
| | 858 | $user = get_user( $user_id ); |
| 859 | 859 | if ( ! $user ) { |
| 860 | 860 | return ''; |
| 861 | 861 | } |
| … |
… |
if ( ! function_exists( 'wp_notify_postauthor' ) ) :
|
| 1653 | 1653 | } |
| 1654 | 1654 | |
| 1655 | 1655 | $post = get_post( $comment->comment_post_ID ); |
| 1656 | | $author = get_userdata( $post->post_author ); |
| | 1656 | $author = get_user( $post->post_author ); |
| 1657 | 1657 | |
| 1658 | 1658 | // Who to notify? By default, just the post author, but others can be added. |
| 1659 | 1659 | $emails = array(); |
| … |
… |
if ( ! function_exists( 'wp_notify_moderator' ) ) :
|
| 1899 | 1899 | |
| 1900 | 1900 | $comment = get_comment( $comment_id ); |
| 1901 | 1901 | $post = get_post( $comment->comment_post_ID ); |
| 1902 | | $user = get_userdata( $post->post_author ); |
| | 1902 | $user = get_user( $post->post_author ); |
| 1903 | 1903 | // Send to the administration and to the post author if the author can modify the comment. |
| 1904 | 1904 | $emails = array( get_option( 'admin_email' ) ); |
| 1905 | 1905 | if ( $user && user_can( $user->ID, 'edit_comment', $comment_id ) && ! empty( $user->user_email ) ) { |
| … |
… |
if ( ! function_exists( 'wp_new_user_notification' ) ) :
|
| 2133 | 2133 | return; |
| 2134 | 2134 | } |
| 2135 | 2135 | |
| 2136 | | $user = get_userdata( $user_id ); |
| | 2136 | $user = get_user( $user_id ); |
| 2137 | 2137 | |
| 2138 | 2138 | /* |
| 2139 | 2139 | * The blogname option is escaped with esc_html() on the way into the database in sanitize_option(). |
-
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 {
|
| 712 | 712 | return $error; |
| 713 | 713 | } |
| 714 | 714 | |
| 715 | | $user = get_userdata( $id ); |
| | 715 | $user = get_user( $id ); |
| 716 | 716 | } |
| 717 | 717 | |
| 718 | 718 | if ( empty( $user ) || ! $user->exists() ) { |
-
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 {
|
| 1293 | 1293 | $post_author = (int) $request['author']; |
| 1294 | 1294 | |
| 1295 | 1295 | if ( get_current_user_id() !== $post_author ) { |
| 1296 | | $user_obj = get_userdata( $post_author ); |
| | 1296 | $user_obj = get_user( $post_author ); |
| 1297 | 1297 | |
| 1298 | 1298 | if ( ! $user_obj ) { |
| 1299 | 1299 | return new WP_Error( |
-
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 {
|
| 605 | 605 | $post_author = (int) $request['author']; |
| 606 | 606 | |
| 607 | 607 | if ( get_current_user_id() !== $post_author ) { |
| 608 | | $user_obj = get_userdata( $post_author ); |
| | 608 | $user_obj = get_user( $post_author ); |
| 609 | 609 | |
| 610 | 610 | if ( ! $user_obj ) { |
| 611 | 611 | return new WP_Error( |
-
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 {
|
| 407 | 407 | return $error; |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | | $user = get_userdata( (int) $id ); |
| | 410 | $user = get_user( (int) $id ); |
| 411 | 411 | if ( empty( $user ) || ! $user->exists() ) { |
| 412 | 412 | return $error; |
| 413 | 413 | } |
| … |
… |
class WP_REST_Users_Controller extends WP_REST_Controller {
|
| 899 | 899 | } |
| 900 | 900 | |
| 901 | 901 | if ( ! empty( $reassign ) ) { |
| 902 | | if ( $reassign === $id || ! get_userdata( $reassign ) ) { |
| | 902 | if ( $reassign === $id || ! get_user( $reassign ) ) { |
| 903 | 903 | return new WP_Error( |
| 904 | 904 | 'rest_user_invalid_reassign', |
| 905 | 905 | __( 'Invalid user ID for reassignment.' ), |
-
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 = '' ) {
|
| 670 | 670 | $user = get_current_user_id(); |
| 671 | 671 | } |
| 672 | 672 | |
| 673 | | $user = get_userdata( $user ); |
| | 673 | $user = get_user( $user ); |
| 674 | 674 | if ( ! $user ) { |
| 675 | 675 | return false; |
| 676 | 676 | } |
| … |
… |
function wp_list_users( $args = array() ) {
|
| 843 | 843 | $users = get_users( $query_args ); |
| 844 | 844 | |
| 845 | 845 | foreach ( $users as $user_id ) { |
| 846 | | $user = get_userdata( $user_id ); |
| | 846 | $user = get_user( $user_id ); |
| 847 | 847 | |
| 848 | 848 | if ( $parsed_args['exclude_admin'] && 'admin' === $user->display_name ) { |
| 849 | 849 | continue; |
| … |
… |
function is_user_member_of_blog( $user_id = 0, $blog_id = 0 ) {
|
| 1072 | 1072 | if ( empty( $user_id ) ) { |
| 1073 | 1073 | return false; |
| 1074 | 1074 | } else { |
| 1075 | | $user = get_userdata( $user_id ); |
| | 1075 | $user = get_user( $user_id ); |
| 1076 | 1076 | if ( ! $user instanceof WP_User ) { |
| 1077 | 1077 | return false; |
| 1078 | 1078 | } |
| … |
… |
function setup_userdata( $for_user_id = 0 ) {
|
| 1505 | 1505 | if ( ! $for_user_id ) { |
| 1506 | 1506 | $for_user_id = get_current_user_id(); |
| 1507 | 1507 | } |
| 1508 | | $user = get_userdata( $for_user_id ); |
| | 1508 | $user = get_user( $for_user_id ); |
| 1509 | 1509 | |
| 1510 | 1510 | if ( ! $user ) { |
| 1511 | 1511 | $user_ID = 0; |
| … |
… |
function wp_dropdown_users( $args = '' ) {
|
| 1698 | 1698 | } |
| 1699 | 1699 | |
| 1700 | 1700 | if ( ! $found_selected ) { |
| 1701 | | $selected_user = get_userdata( $parsed_args['selected'] ); |
| | 1701 | $selected_user = get_user( $parsed_args['selected'] ); |
| 1702 | 1702 | if ( $selected_user ) { |
| 1703 | 1703 | $users[] = $selected_user; |
| 1704 | 1704 | } |
| … |
… |
function wp_insert_user( $userdata ) {
|
| 2089 | 2089 | if ( ! empty( $userdata['ID'] ) ) { |
| 2090 | 2090 | $user_id = (int) $userdata['ID']; |
| 2091 | 2091 | $update = true; |
| 2092 | | $old_user_data = get_userdata( $user_id ); |
| | 2092 | $old_user_data = get_user( $user_id ); |
| 2093 | 2093 | |
| 2094 | 2094 | if ( ! $old_user_data ) { |
| 2095 | 2095 | return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) ); |
| … |
… |
function wp_update_user( $userdata ) {
|
| 2538 | 2538 | } |
| 2539 | 2539 | |
| 2540 | 2540 | // First, get all of the original fields. |
| 2541 | | $user_obj = get_userdata( $user_id ); |
| | 2541 | $user_obj = get_user( $user_id ); |
| 2542 | 2542 | if ( ! $user_obj ) { |
| 2543 | 2543 | return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) ); |
| 2544 | 2544 | } |
| … |
… |
function wp_is_application_passwords_available_for_user( $user ) {
|
| 4973 | 4973 | } |
| 4974 | 4974 | |
| 4975 | 4975 | if ( ! is_object( $user ) ) { |
| 4976 | | $user = get_userdata( $user ); |
| | 4976 | $user = get_user( $user ); |
| 4977 | 4977 | } |
| 4978 | 4978 | |
| 4979 | 4979 | if ( ! $user || ! $user->exists() ) { |
| … |
… |
function wp_cache_set_users_last_changed() {
|
| 5057 | 5057 | */ |
| 5058 | 5058 | function wp_is_password_reset_allowed_for_user( $user ) { |
| 5059 | 5059 | if ( ! is_object( $user ) ) { |
| 5060 | | $user = get_userdata( $user ); |
| | 5060 | $user = get_user( $user ); |
| 5061 | 5061 | } |
| 5062 | 5062 | |
| 5063 | 5063 | if ( ! $user || ! $user->exists() ) { |