Changeset 63065
- Timestamp:
- 08/06/2026 03:38:58 PM (2 months ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
-
wp-admin/includes/user.php (modified) (3 diffs)
-
wp-includes/user.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/user.php
r62688 r63065 45 45 } 46 46 47 $errors = new WP_Error(); 48 47 49 $pass1 = ''; 48 50 $pass2 = ''; … … 79 81 80 82 if ( isset( $_POST['email'] ) ) { 81 $user->user_email = sanitize_text_field( wp_unslash( $_POST['email'] ) ); 83 $maybe_email = wp_unslash( $_POST['email'] ); 84 if ( is_string( $maybe_email ) && is_email( $maybe_email ) ) { 85 $user->user_email = $maybe_email; 86 } else { 87 $errors->add( 'invalid_email', __( '<strong>Error:</strong> The email address is not correct.' ), array( 'form-field' => 'email' ) ); 88 } 82 89 } 83 90 if ( isset( $_POST['url'] ) ) { … … 146 153 $user->use_ssl = 1; 147 154 } 148 149 $errors = new WP_Error();150 155 151 156 /* checking that username has been typed */ -
trunk/src/wp-includes/user.php
r62654 r63065 3859 3859 * @since 3.0.0 3860 3860 * @since 4.9.0 This function was moved from wp-admin/includes/ms.php so it's no longer Multisite specific. 3861 * @since 7.0.3 Added the `$user_id` parameter, which is sent with the `personal_options_update` action. 3862 * 3863 * @param int $user_id Optional. The ID of the user whose email is being changed. Defaults to `$_POST['user_id']` if set, otherwise 0. 3861 3864 * 3862 3865 * @global WP_Error $errors WP_Error object. 3863 3866 */ 3864 function send_confirmation_on_profile_email( ) {3867 function send_confirmation_on_profile_email( $user_id = 0 ) { 3865 3868 global $errors; 3869 3870 // Maintain backward compatibility for those relying on a check based on $_POST['user_id']. 3871 if ( ! $user_id && isset( $_POST['user_id'] ) ) { 3872 $user_id = absint( $_POST['user_id'] ); 3873 } 3866 3874 3867 3875 $current_user = wp_get_current_user(); … … 3870 3878 } 3871 3879 3872 if ( $current_user->ID !== (int) $_POST['user_id']) {3880 if ( 0 === $current_user->ID || $current_user->ID !== (int) $user_id ) { 3873 3881 return false; 3874 3882 } … … 3884 3892 ); 3885 3893 3894 $_POST['email'] = addslashes( $current_user->user_email ); 3886 3895 return; 3887 3896 } … … 3897 3906 delete_user_meta( $current_user->ID, '_new_email' ); 3898 3907 3908 $_POST['email'] = addslashes( $current_user->user_email ); 3899 3909 return; 3900 3910 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)