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/includes/network.php

    r55703 r56409  
    126126        $active_plugins = get_option( 'active_plugins' );
    127127        if ( ! empty( $active_plugins ) ) {
    128                 echo '<div class="notice notice-warning"><p><strong>' . __( 'Warning:' ) . '</strong> ' . sprintf(
    129                         /* translators: %s: URL to Plugins screen. */
    130                         __( 'Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.' ),
    131                         admin_url( 'plugins.php?plugin_status=active' )
    132                 ) . '</p></div>';
     128                wp_admin_notice(
     129                        '<strong>' . __( 'Warning:' ) . '</strong> ' . sprintf(
     130                                /* translators: %s: URL to Plugins screen. */
     131                                __( 'Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.' ),
     132                                admin_url( 'plugins.php?plugin_status=active' )
     133                        ),
     134                        array( 'type' => 'warning' )
     135                );
    133136                echo '<p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>';
    134137                echo '</div>';
    … …  
    439442                <h3><?php esc_html_e( 'Enabling the Network' ); ?></h3>
    440443                <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p>
    441                 <div class="notice notice-warning inline"><p>
    442444                <?php
     445                $notice_message = '<strong>' . __( 'Caution:' ) . '</strong> ';
     446                $notice_args    = array(
     447                        'type'               => 'warning',
     448                        'additional_classes' => 'inline',
     449                );
     450
    443451                if ( file_exists( $home_path . '.htaccess' ) ) {
    444                         echo '<strong>' . __( 'Caution:' ) . '</strong> ';
    445                         printf(
     452                        $notice_message .= sprintf(
    446453                                /* translators: 1: wp-config.php, 2: .htaccess */
    447454                                __( 'You should back up your existing %1$s and %2$s files.' ),
    … …  
    450457                        );
    451458                } elseif ( file_exists( $home_path . 'web.config' ) ) {
    452                         echo '<strong>' . __( 'Caution:' ) . '</strong> ';
    453                         printf(
     459                        $notice_message .= sprintf(
    454460                                /* translators: 1: wp-config.php, 2: web.config */
    455461                                __( 'You should back up your existing %1$s and %2$s files.' ),
    … …  
    458464                        );
    459465                } else {
    460                         echo '<strong>' . __( 'Caution:' ) . '</strong> ';
    461                         printf(
     466                        $notice_message .= sprintf(
    462467                                /* translators: %s: wp-config.php */
    463468                                __( 'You should back up your existing %s file.' ),
    … …  
    465470                        );
    466471                }
    467                 ?>
    468                 </p></div>
    469                 <?php
     472
     473                wp_admin_notice( $notice_message, $notice_args );
    470474        }
    471475        ?>
Note: See TracChangeset for help on using the changeset viewer.