Changeset 47122 for trunk/src/wp-includes/user.php
- Timestamp:
- 01/29/2020 12:43:23 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/user.php (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/user.php
r47101 r47122 88 88 $secure_cookie = apply_filters( 'secure_signon_cookie', $secure_cookie, $credentials ); 89 89 90 global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie 90 global $auth_secure_cookie; // XXX ugly hack to pass this to wp_authenticate_cookie(). 91 91 $auth_secure_cookie = $secure_cookie; 92 92 … … 209 209 210 210 if ( empty( $email ) ) { 211 $error->add( 'empty_username', __( '<strong>ERROR</strong>: The email field is empty.' ) ); // Uses 'empty_username' for back-compat with wp_signon() 211 // Uses 'empty_username' for back-compat with wp_signon(). 212 $error->add( 'empty_username', __( '<strong>ERROR</strong>: The email field is empty.' ) ); 212 213 } 213 214 … … 427 428 428 429 // 429 // User option functions 430 // User option functions. 430 431 // 431 432 … … 481 482 482 483 $prefix = $wpdb->get_blog_prefix(); 483 if ( $user->has_prop( $prefix . $option ) ) { // Blog specific484 if ( $user->has_prop( $prefix . $option ) ) { // Blog-specific. 484 485 $result = $user->get( $prefix . $option ); 485 } elseif ( $user->has_prop( $option ) ) { // User specific and cross-blog486 } elseif ( $user->has_prop( $option ) ) { // User-specific and cross-blog. 486 487 $result = $user->get( $option ); 487 488 } else { … … 600 601 $user_id = (int) $user_id; 601 602 602 // Logged out users can't have sites 603 // Logged out users can't have sites. 603 604 if ( empty( $user_id ) ) { 604 605 return array(); … … 734 735 } 735 736 736 // Technically not needed, but does save calls to get_site and get_user_meta737 // in the event that the function is called when a user isn't logged in 737 // Technically not needed, but does save calls to get_site() and get_user_meta() 738 // in the event that the function is called when a user isn't logged in. 738 739 if ( empty( $user_id ) ) { 739 740 return false; … … 764 765 } 765 766 766 // no underscore before capabilities in $base_capabilities_key767 // No underscore before capabilities in $base_capabilities_key. 767 768 $base_capabilities_key = $wpdb->base_prefix . 'capabilities'; 768 769 $site_capabilities_key = $wpdb->base_prefix . $blog_id . '_capabilities'; … … 876 877 global $wpdb; 877 878 878 // Initialize 879 // Initialize. 879 880 if ( ! $site_id ) { 880 881 $site_id = get_current_blog_id(); … … 985 986 986 987 // 987 // Private helper functions 988 // Private helper functions. 988 989 // 989 990 … … 1541 1542 } 1542 1543 1543 // hashed in wp_update_user(), plaintext if called directly 1544 // hashed in wp_update_user(), plaintext if called directly. 1544 1545 $user_pass = ! empty( $userdata['user_pass'] ) ? $userdata['user_pass'] : $old_user_data->user_pass; 1545 1546 } else { 1546 1547 $update = false; 1547 // Hash the password 1548 // Hash the password. 1548 1549 $user_pass = wp_hash_password( $userdata['user_pass'] ); 1549 1550 } … … 1562 1563 $pre_user_login = apply_filters( 'pre_user_login', $sanitized_user_login ); 1563 1564 1564 // Remove any non-printable chars from the login string to see if we have ended up with an empty username1565 // Remove any non-printable chars from the login string to see if we have ended up with an empty username. 1565 1566 $user_login = trim( $pre_user_login ); 1566 1567 … … 1934 1935 } 1935 1936 1936 // First, get all of the original fields 1937 // First, get all of the original fields. 1937 1938 $user_obj = get_userdata( $ID ); 1938 1939 if ( ! $user_obj ) { … … 1942 1943 $user = $user_obj->to_array(); 1943 1944 1944 // Add additional custom fields 1945 // Add additional custom fields. 1945 1946 foreach ( _get_additional_user_keys( $user_obj ) as $key ) { 1946 1947 $user[ $key ] = get_user_meta( $ID, $key, true ); … … 1951 1952 1952 1953 if ( ! empty( $userdata['user_pass'] ) && $userdata['user_pass'] !== $user_obj->user_pass ) { 1953 // If password is changing, hash it now 1954 // If password is changing, hash it now. 1954 1955 $plaintext_pass = $userdata['user_pass']; 1955 1956 $userdata['user_pass'] = wp_hash_password( $userdata['user_pass'] ); … … 2412 2413 return $user; 2413 2414 } elseif ( $hash_is_correct && $expiration_time ) { 2414 // Key has an expiration time that's passed 2415 // Key has an expiration time that's passed. 2415 2416 return new WP_Error( 'expired_key', __( 'Invalid key.' ) ); 2416 2417 } … … 2492 2493 $user_email = apply_filters( 'user_registration_email', $user_email ); 2493 2494 2494 // Check the username 2495 // Check the username. 2495 2496 if ( $sanitized_user_login == '' ) { 2496 2497 $errors->add( 'empty_username', __( '<strong>ERROR</strong>: Please enter a username.' ) ); … … 2509 2510 } 2510 2511 2511 // Check the email address 2512 // Check the email address. 2512 2513 if ( $user_email == '' ) { 2513 2514 $errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please type your email address.' ) ); … … 2568 2569 } 2569 2570 2570 update_user_option( $user_id, 'default_password_nag', true, true ); // Set up the Password change nag.2571 update_user_option( $user_id, 'default_password_nag', true, true ); // Set up the password change nag. 2571 2572 2572 2573 /** … … 2729 2730 } 2730 2731 2731 // Upgrade stdClass to WP_User 2732 // Upgrade stdClass to WP_User. 2732 2733 if ( is_object( $current_user ) && isset( $current_user->ID ) ) { 2733 2734 $cur_id = $current_user->ID; … … 3406 3407 array( 3407 3408 'post_type' => 'user_request', 3408 'post_name__in' => array( $action_name ), // Action name stored in post_name column.3409 'title' => $email_address, // Email address stored in post_title column.3409 'post_name__in' => array( $action_name ), // Action name stored in post_name column. 3410 'title' => $email_address, // Email address stored in post_title column. 3410 3411 'post_status' => array( 3411 3412 'request-pending',
Note: See TracChangeset
for help on using the changeset viewer.