Make WordPress Core


Ignore:
Timestamp:
09/17/2023 03:21:07 PM (2 years ago)
Author:
costdev
Message:

Administration: Use wp_admin_notice() more in /wp-admin/includes/.

Adds further usages of wp_admin_notice() in /wp-admin/includes/ on .notice-error, .notice-warning, .error, and .updated.

Ongoing task to implement new function across core.

Follow-up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597].

Props joedolson, mukesh27, costdev.
See #57791.

File:
1 edited

Legend:

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

    r55988 r56599  
    536536        return;
    537537    }
    538     ?>
    539     <div class="error default-password-nag">
    540         <p>
    541             <strong><?php _e( 'Notice:' ); ?></strong>
    542             <?php _e( 'You are using the auto-generated password for your account. Would you like to change it?' ); ?>
    543         </p>
    544         <p>
    545         <?php
    546         printf(
    547             '<a href="%1$s">%2$s</a> | ',
    548             esc_url( get_edit_profile_url() . '#password' ),
    549             __( 'Yes, take me to my profile page' )
    550         );
    551         printf(
    552             '<a href="%1$s" id="default-password-nag-no">%2$s</a>',
    553             '?default_password_nag=0',
    554             __( 'No thanks, do not remind me again' )
    555         );
    556         ?>
    557         </p>
    558     </div>
    559     <?php
     538
     539    $default_password_nag_message  = sprintf(
     540        '<p><strong>%1$s</strong> %2$s</p>',
     541        __( 'Notice:' ),
     542        __( 'You are using the auto-generated password for your account. Would you like to change it?' )
     543    );
     544    $default_password_nag_message .= sprintf(
     545        '<p><a href="%1$s">%2$s</a> | ',
     546        esc_url( get_edit_profile_url() . '#password' ),
     547        __( 'Yes, take me to my profile page' )
     548    );
     549    $default_password_nag_message .= sprintf(
     550        '<a href="%1$s" id="default-password-nag-no">%2$s</a></p>',
     551        '?default_password_nag=0',
     552        __( 'No thanks, do not remind me again' )
     553    );
     554
     555    wp_admin_notice(
     556        $default_password_nag_message,
     557        array(
     558            'additional_classes' => array( 'error', 'default-password-nag' ),
     559            'paragraph_wrap'     => false,
     560        )
     561    );
    560562}
    561563
Note: See TracChangeset for help on using the changeset viewer.