Make WordPress Core


Ignore:
Timestamp:
10/07/2026 01:40:25 PM (8 hours ago)
Author:
afercia
Message:

Users: Improve the usability and consistency of the admin notices related to email changes.

  • Renders an admin 'info' notice in the General Settings page when changing the administration email.
  • The notice is similar to the one already rendered in the User Profile when changing the user email.
  • Both the notices at the top are now rendered after the 'settings saved' one.
  • For both notices:
  • The 'Cancel' link text is now a more meaningful 'Cancel request'.
  • The 'Cancel request' link is now rendered also in the admin notice at the top.
  • The notices in the middle of the page are now of type 'info' instead of 'success'. This is consistent with the notices at the top. Also, the notices content is informative and the previous 'success' type was not appropriate.
  • Changes the text of one of the notices by updating the text 'admin email' to 'administration email' for consistency with the related setting label.
  • Improves the redirect links by using add_query_arg().

Developed in ​https://github.com/WordPress/wordpress-develop/pull/13927

Fixes #66173.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r64163 r64228  
    40184018        global $pagenow;
    40194019
    4020         if ( 'profile.php' === $pagenow && isset( $_GET['updated'] ) ) {
    4021                 $email = get_user_meta( get_current_user_id(), '_new_email', true );
     4020        if ( 'profile.php' === $pagenow ) {
     4021                $current_user_id = get_current_user_id();
     4022                $email           = get_user_meta( $current_user_id, '_new_email', true );
    40224023                if ( $email ) {
    40234024                        $message = sprintf(
    … …  
    40254026                                __( 'Your email address has not been updated yet. Please check your inbox at %s for a confirmation email.' ),
    40264027                                '<code>' . esc_html( $email['newemail'] ) . '</code>'
     4028                        );
     4029                        $message .= sprintf(
     4030                                ' <a href="%1$s">%2$s</a>',
     4031                                esc_url( wp_nonce_url( self_admin_url( 'profile.php?dismiss=' . $current_user_id . '_new_email' ), 'dismiss-' . $current_user_id . '_new_email' ) ),
     4032                                _x( 'Cancel request', 'user email change' ),
    40274033                        );
    40284034                        wp_admin_notice( $message, array( 'type' => 'info' ) );
Note: See TracChangeset for help on using the changeset viewer.