Make WordPress Core


Ignore:
Timestamp:
09/14/2023 02:13:42 AM (3 years ago)
Author:
joedolson
Message:

Administration: Use wp_admin_notice() for .updated.

Add usages of wp_admin_notice() and wp_get_admin_notice() on .updated in the root level of /wp-admin/. Ongoing task to implement new function across core.

Props costdev, joedolson.
See #57791.

File:
1 edited

Legend:

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

    r56570 r56573  
    546546                                                        <?php endif; ?>
    547547
    548                                                         <?php $new_email = get_user_meta( $current_user->ID, '_new_email', true ); ?>
    549                                                         <?php if ( $new_email && $new_email['newemail'] !== $current_user->user_email && $profile_user->ID === $current_user->ID ) : ?>
    550                                                         <div class="updated inline">
    551                                                                 <p>
    552                                                                         <?php
    553                                                                         printf(
    554                                                                                 /* translators: %s: New email. */
    555                                                                                 __( 'There is a pending change of your email to %s.' ),
    556                                                                                 '<code>' . esc_html( $new_email['newemail'] ) . '</code>'
    557                                                                         );
    558                                                                         printf(
    559                                                                                 ' <a href="%1$s">%2$s</a>',
    560                                                                                 esc_url( wp_nonce_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ), 'dismiss-' . $current_user->ID . '_new_email' ) ),
    561                                                                                 __( 'Cancel' )
    562                                                                         );
    563                                                                         ?>
    564                                                                 </p>
    565                                                         </div>
    566                                                         <?php endif; ?>
     548                                                        <?php
     549                                                        $new_email = get_user_meta( $current_user->ID, '_new_email', true );
     550                                                        if ( $new_email && $new_email['newemail'] !== $current_user->user_email && $profile_user->ID === $current_user->ID ) :
     551
     552                                                                $pending_change_message  = sprintf(
     553                                                                        /* translators: %s: New email. */
     554                                                                        __( 'There is a pending change of your email to %s.' ),
     555                                                                        '<code>' . esc_html( $new_email['newemail'] ) . '</code>'
     556                                                                );
     557                                                                $pending_change_message .= sprintf(
     558                                                                        ' <a href="%1$s">%2$s</a>',
     559                                                                        esc_url( wp_nonce_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ), 'dismiss-' . $current_user->ID . '_new_email' ) ),
     560                                                                        __( 'Cancel' )
     561                                                                );
     562                                                                wp_admin_notice(
     563                                                                        $pending_change_message,
     564                                                                        array(
     565                                                                                'additional_classes' => array( 'updated', 'inline' ),
     566                                                                        )
     567                                                                );
     568                                                        endif;
     569                                                        ?>
    567570                                                </td>
    568571                                        </tr>
Note: See TracChangeset for help on using the changeset viewer.