Make WordPress Core


Ignore:
Timestamp:
08/17/2023 09:01:17 PM (3 years ago)
Author:
joedolson
Message:

Administration: Apply admin notice functions in multisite.

Use wp_get_admin_notice and wp_admin_notice to handle multisite settings notices.

Props costdev.
See #57791.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/network/settings.php

    r55877 r56409  
    139139
    140140if ( isset( $_GET['updated'] ) ) {
    141         ?>
    142         <div id="message" class="notice notice-success is-dismissible"><p><?php _e( 'Settings saved.' ); ?></p></div>
    143         <?php
     141        wp_admin_notice(
     142                __( 'Settings saved.' ),
     143                array(
     144                        'type'        => 'success',
     145                        'dismissible' => true,
     146                        'id'          => 'message',
     147                )
     148        );
    144149}
    145150?>
     
    168173                                        $new_admin_email = get_site_option( 'new_admin_email' );
    169174                                        if ( $new_admin_email && get_site_option( 'admin_email' ) !== $new_admin_email ) :
    170                                                 ?>
    171                                                 <div class="notice notice-warning is-dismissible inline">
    172                                                 <p>
    173                                                 <?php
    174                                                         printf(
    175                                                                 /* translators: %s: New network admin email. */
    176                                                                 __( 'There is a pending change of the network admin email to %s.' ),
    177                                                                 '<code>' . esc_html( $new_admin_email ) . '</code>'
    178                                                         );
    179                                                         printf(
    180                                                                 ' <a href="%1$s">%2$s</a>',
    181                                                                 esc_url( wp_nonce_url( network_admin_url( 'settings.php?dismiss=new_network_admin_email' ), 'dismiss_new_network_admin_email' ) ),
    182                                                                 __( 'Cancel' )
    183                                                         );
    184                                                 ?>
    185                                                 </p>
    186                                                 </div>
    187                                         <?php endif; ?>
     175                                                $notice_message = sprintf(
     176                                                        /* translators: %s: New network admin email. */
     177                                                        __( 'There is a pending change of the network admin email to %s.' ),
     178                                                        '<code>' . esc_html( $new_admin_email ) . '</code>'
     179                                                );
     180
     181                                                $notice_message .= sprintf(
     182                                                        ' <a href="%1$s">%2$s</a>',
     183                                                        esc_url( wp_nonce_url( network_admin_url( 'settings.php?dismiss=new_network_admin_email' ), 'dismiss_new_network_admin_email' ) ),
     184                                                        __( 'Cancel' )
     185                                                );
     186
     187                                                wp_admin_notice(
     188                                                        $notice_message,
     189                                                        array(
     190                                                                'type'               => 'warning',
     191                                                                'dismissible'        => true,
     192                                                                'additional_classes' => array( 'inline' ),
     193                                                        )
     194                                                );
     195                                        endif;
     196                                        ?>
    188197                                </td>
    189198                        </tr>
Note: See TracChangeset for help on using the changeset viewer.