- Timestamp:
- 07/10/2021 12:20:55 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/user.php
r51398 r51399 1774 1774 // Are we updating or creating? 1775 1775 if ( ! empty( $userdata['ID'] ) ) { 1776 $ ID= (int) $userdata['ID'];1776 $user_id = (int) $userdata['ID']; 1777 1777 $update = true; 1778 $old_user_data = get_userdata( $ ID);1778 $old_user_data = get_userdata( $user_id ); 1779 1779 1780 1780 if ( ! $old_user_data ) { … … 2032 2032 * } 2033 2033 * @param bool $update Whether the user is being updated rather than created. 2034 * @param int|null $ idID of the user to be updated, or NULL if the user is being created.2034 * @param int|null $user_id ID of the user to be updated, or NULL if the user is being created. 2035 2035 * @param array $userdata The raw array of data passed to wp_insert_user(). 2036 2036 */ 2037 $data = apply_filters( 'wp_pre_insert_user_data', $data, $update, ( $update ? (int) $ID: null ), $userdata );2037 $data = apply_filters( 'wp_pre_insert_user_data', $data, $update, ( $update ? $user_id : null ), $userdata ); 2038 2038 2039 2039 if ( empty( $data ) || ! is_array( $data ) ) { … … 2045 2045 $data['user_activation_key'] = ''; 2046 2046 } 2047 $wpdb->update( $wpdb->users, $data, compact( 'ID' ) ); 2048 $user_id = (int) $ID; 2047 $wpdb->update( $wpdb->users, $data, array( 'ID' => $user_id ) ); 2049 2048 } else { 2050 2049 $wpdb->insert( $wpdb->users, $data ); … … 2178 2177 } 2179 2178 2180 $ ID= isset( $userdata['ID'] ) ? (int) $userdata['ID'] : 0;2181 if ( ! $ ID) {2179 $user_id = isset( $userdata['ID'] ) ? (int) $userdata['ID'] : 0; 2180 if ( ! $user_id ) { 2182 2181 return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) ); 2183 2182 } 2184 2183 2185 2184 // First, get all of the original fields. 2186 $user_obj = get_userdata( $ ID);2185 $user_obj = get_userdata( $user_id ); 2187 2186 if ( ! $user_obj ) { 2188 2187 return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) ); … … 2193 2192 // Add additional custom fields. 2194 2193 foreach ( _get_additional_user_keys( $user_obj ) as $key ) { 2195 $user[ $key ] = get_user_meta( $ ID, $key, true );2194 $user[ $key ] = get_user_meta( $user_id, $key, true ); 2196 2195 } 2197 2196 … … 2374 2373 // Update the cookies if the password changed. 2375 2374 $current_user = wp_get_current_user(); 2376 if ( $current_user->ID == $ ID) {2375 if ( $current_user->ID == $user_id ) { 2377 2376 if ( isset( $plaintext_pass ) ) { 2378 2377 wp_clear_auth_cookie(); … … 2382 2381 $logged_in_cookie = wp_parse_auth_cookie( '', 'logged_in' ); 2383 2382 /** This filter is documented in wp-includes/pluggable.php */ 2384 $default_cookie_life = apply_filters( 'auth_cookie_expiration', ( 2 * DAY_IN_SECONDS ), $ ID, false );2383 $default_cookie_life = apply_filters( 'auth_cookie_expiration', ( 2 * DAY_IN_SECONDS ), $user_id, false ); 2385 2384 $remember = false; 2386 2385 if ( false !== $logged_in_cookie && ( $logged_in_cookie['expiration'] - time() ) > $default_cookie_life ) { … … 2388 2387 } 2389 2388 2390 wp_set_auth_cookie( $ ID, $remember );2389 wp_set_auth_cookie( $user_id, $remember ); 2391 2390 } 2392 2391 } … … 2551 2550 * @since 2.7.0 2552 2551 * 2553 * @param bool $allow Whether to allow the password to be reset. Default true.2554 * @param int $ IDThe ID of the user attempting to reset a password.2552 * @param bool $allow Whether to allow the password to be reset. Default true. 2553 * @param int $user_id The ID of the user attempting to reset a password. 2555 2554 */ 2556 2555 $allow = apply_filters( 'allow_password_reset', $allow, $user->ID );
Note: See TracChangeset
for help on using the changeset viewer.