Make WordPress Core

Changeset 56600


Ignore:
Timestamp:
09/17/2023 03:31:32 PM (9 months ago)
Author:
joedolson
Message:

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

Add additional usage of wp_admin_notice() in wp-admin/ on .error and miscellaneous usages previously overlooked.

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

Props costdev, joedolson.
See #57791.

Location:
trunk/src/wp-admin
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/async-upload.php

    r52646 r56600  
    114114$id = media_handle_upload( 'async-upload', $post_id );
    115115if ( is_wp_error( $id ) ) {
    116     printf(
    117         '<div class="error-div error">%s <strong>%s</strong><br />%s</div>',
     116    $message = sprintf(
     117        '%s <strong>%s</strong><br />%s',
    118118        sprintf(
    119119            '<button type="button" class="dismiss button-link" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">%s</button>',
     
    126126        ),
    127127        esc_html( $id->get_error_message() )
     128    );
     129    wp_admin_notice(
     130        $message,
     131        array(
     132            'additional_classes' => array( 'error-div', 'error' ),
     133            'paragraph_wrap'     => false,
     134        )
    128135    );
    129136    exit;
  • trunk/src/wp-admin/edit-comments.php

    r56576 r56600  
    302302    }
    303303    if ( $error_msg ) {
    304         echo '<div id="moderated" class="error"><p>' . $error_msg . '</p></div>';
     304        wp_admin_notice(
     305            $error_msg,
     306            array(
     307                'id'                 => 'moderated',
     308                'additional_classes' => array( 'error' ),
     309            )
     310        );
    305311    }
    306312}
  • trunk/src/wp-admin/edit-form-advanced.php

    r56570 r56600  
    463463    );
    464464endif;
    465 ?>
    466 <div id="lost-connection-notice" class="error hidden">
    467     <p><span class="spinner"></span> <?php _e( '<strong>Connection lost.</strong> Saving has been disabled until you are reconnected.' ); ?>
    468     <span class="hide-if-no-sessionstorage"><?php _e( 'This post is being backed up in your browser, just in case.' ); ?></span>
    469     </p>
    470 </div>
     465
     466$connection_lost_message = sprintf(
     467    '<span class="spinner"></span> %1$s <span class="hide-if-no-sessionstorage">%2$s</span>',
     468    __( '<strong>Connection lost.</strong> Saving has been disabled until you are reconnected.' ),
     469    __( 'This post is being backed up in your browser, just in case.' )
     470);
     471
     472wp_admin_notice(
     473    $connection_lost_message,
     474    array(
     475        'id'                 => 'lost-connection-notice',
     476        'additional_classes' => array( 'error', 'hidden' ),
     477    )
     478);
     479?>
    471480<form name="post" action="post.php" method="post" id="post"
    472481<?php
  • trunk/src/wp-admin/edit-tags.php

    r55412 r56600  
    349349<hr class="wp-header-end">
    350350
    351 <?php if ( $message ) : ?>
    352 <div id="message" class="<?php echo $class; ?> notice is-dismissible"><p><?php echo $message; ?></p></div>
    353     <?php
     351<?php
     352if ( $message ) :
     353    wp_admin_notice(
     354        $message,
     355        array(
     356            'id'                 => 'message',
     357            'additional_classes' => array( $class ),
     358            'dismissible'        => true,
     359        )
     360    );
    354361    $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message', 'error' ), $_SERVER['REQUEST_URI'] );
    355362endif;
  • trunk/src/wp-admin/import.php

    r55412 r56600  
    6161<div class="wrap">
    6262<h1><?php echo esc_html( $title ); ?></h1>
    63 <?php if ( ! empty( $_GET['invalid'] ) ) : ?>
    64     <div class="error">
    65         <p><strong><?php _e( 'Error:' ); ?></strong>
    66             <?php
    67             /* translators: %s: Importer slug. */
    68             printf( __( 'The %s importer is invalid or is not installed.' ), '<strong>' . esc_html( $_GET['invalid'] ) . '</strong>' );
    69             ?>
    70         </p>
    71     </div>
    72 <?php endif; ?>
     63<?php
     64if ( ! empty( $_GET['invalid'] ) ) :
     65    $importer_not_installed = '<strong>' . __( 'Error:' ) . '</strong> ' . sprintf(
     66        /* translators: %s: Importer slug. */
     67        __( 'The %s importer is invalid or is not installed.' ),
     68        '<strong>' . esc_html( $_GET['invalid'] ) . '</strong>'
     69    );
     70    wp_admin_notice(
     71        $importer_not_installed,
     72        array(
     73            'additional_classes' => array( 'error' ),
     74        )
     75    );
     76endif;
     77?>
    7378<p><?php _e( 'If you have posts or comments in another system, WordPress can import those into this site. To get started, choose a system to import from below:' ); ?></p>
    7479
  • trunk/src/wp-admin/nav-menus.php

    r56573 r56600  
    385385
    386386                if ( is_wp_error( $_nav_menu_selected_id ) ) {
    387                     $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>';
     387                    $messages[] = wp_get_admin_notice(
     388                        $_nav_menu_selected_id->get_error_message(),
     389                        array(
     390                            'id'                 => 'message',
     391                            'additional_classes' => array( 'error' ),
     392                            'dismissible'        => true,
     393                        )
     394                    );
    388395                } else {
    389396                    $_menu_object            = wp_get_nav_menu_object( $_nav_menu_selected_id );
     
    436443                }
    437444            } else {
    438                 $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( 'Please enter a valid menu name.' ) . '</p></div>';
     445                $messages[] = wp_get_admin_notice(
     446                    __( 'Please enter a valid menu name.' ),
     447                    array(
     448                        'id'                 => 'message',
     449                        'additional_classes' => array( 'error' ),
     450                        'dismissible'        => true,
     451                    )
     452                );
    439453            }
    440454
     
    458472
    459473            if ( ! $menu_title ) {
    460                 $messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( 'Please enter a valid menu name.' ) . '</p></div>';
     474                $messages[] = wp_get_admin_notice(
     475                    __( 'Please enter a valid menu name.' ),
     476                    array(
     477                        'id'                 => 'message',
     478                        'additional_classes' => array( 'error' ),
     479                        'dismissible'        => true,
     480                    )
     481                );
    461482                $menu_title = $_menu_object->name;
    462483            }
     
    511532            set_theme_mod( 'nav_menu_locations', $menu_locations );
    512533
    513             $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Menu locations updated.' ) . '</p></div>';
     534            $messages[] = wp_get_admin_notice(
     535                __( 'Menu locations updated.' ),
     536                array(
     537                    'id'                 => 'message',
     538                    'additional_classes' => array( 'updated' ),
     539                    'dismissible'        => true,
     540                )
     541            );
    514542        }
    515543
  • trunk/src/wp-admin/plugin-editor.php

    r56570 r56600  
    3030    <div class="wrap">
    3131        <h1><?php echo esc_html( $title ); ?></h1>
    32         <div id="message" class="error"><p><?php _e( 'No plugins are currently available.' ); ?></p></div>
     32        <?php
     33        wp_admin_notice(
     34            __( 'No plugins are currently available.' ),
     35            array(
     36                'id'                 => 'message',
     37                'additional_classes' => array( 'error' ),
     38            )
     39        );
     40        ?>
    3341    </div>
    3442    <?php
  • trunk/src/wp-admin/plugins.php

    r56589 r56600  
    340340                <?php if ( 1 === $plugins_to_delete ) : ?>
    341341                    <h1><?php _e( 'Delete Plugin' ); ?></h1>
    342                     <?php if ( $have_non_network_plugins && is_network_admin() ) : ?>
    343                         <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This plugin may be active on other sites in the network.' ); ?></p></div>
    344                     <?php endif; ?>
     342                    <?php
     343                    if ( $have_non_network_plugins && is_network_admin() ) :
     344                        $maybe_active_plugin = '<strong>' . __( 'Caution:' ) . '</strong> ' . __( 'This plugin may be active on other sites in the network.' );
     345                        wp_admin_notice(
     346                            $maybe_active_plugin,
     347                            array(
     348                                'additional_classes' => array( 'error' ),
     349                            )
     350                        );
     351                    endif;
     352                    ?>
    345353                    <p><?php _e( 'You are about to remove the following plugin:' ); ?></p>
    346354                <?php else : ?>
    347355                    <h1><?php _e( 'Delete Plugins' ); ?></h1>
    348                     <?php if ( $have_non_network_plugins && is_network_admin() ) : ?>
    349                         <div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These plugins may be active on other sites in the network.' ); ?></p></div>
    350                     <?php endif; ?>
     356                    <?php
     357                    if ( $have_non_network_plugins && is_network_admin() ) :
     358                        $maybe_active_plugins = '<strong>' . __( 'Caution:' ) . '</strong> ' . __( 'These plugins may be active on other sites in the network.' );
     359                        wp_admin_notice(
     360                            $maybe_active_plugins,
     361                            array(
     362                                'additional_classes' => array( 'error' ),
     363                            )
     364                        );
     365                    endif;
     366                    ?>
    351367                    <p><?php _e( 'You are about to remove the following plugins:' ); ?></p>
    352368                <?php endif; ?>
     
    608624if ( ! empty( $invalid ) ) {
    609625    foreach ( $invalid as $plugin_file => $error ) {
    610         echo '<div id="message" class="error"><p>';
    611         printf(
     626        $deactivated_message = sprintf(
    612627            /* translators: 1: Plugin file, 2: Error message. */
    613628            __( 'The plugin %1$s has been deactivated due to an error: %2$s' ),
     
    615630            esc_html( $error->get_error_message() )
    616631        );
    617         echo '</p></div>';
     632        wp_admin_notice(
     633            $deactivated_message,
     634            array(
     635                'id'                 => 'message',
     636                'additional_classes' => array( 'error' ),
     637            )
     638        );
    618639    }
    619640}
  • trunk/src/wp-admin/theme-editor.php

    r56570 r56600  
    263263<?php
    264264if ( $theme->errors() ) {
    265     echo '<div class="error"><p><strong>' . __( 'This theme is broken.' ) . '</strong> ' . $theme->errors()->get_error_message() . '</p></div>';
     265    wp_admin_notice(
     266        '<strong>' . __( 'This theme is broken.' ) . '</strong> ' . $theme->errors()->get_error_message(),
     267        array(
     268            'additional_classes' => array( 'error' ),
     269        )
     270    );
    266271}
    267272?>
     
    295300<?php
    296301if ( $error ) :
    297     echo '<div class="error"><p>' . __( 'File does not exist! Please double check the name and try again.' ) . '</p></div>';
     302    wp_admin_notice(
     303        __( 'File does not exist! Please double check the name and try again.' ),
     304        array(
     305            'additional_classes' => array( 'error' ),
     306        )
     307    );
    298308else :
    299309    ?>
  • trunk/src/wp-admin/theme-install.php

    r56570 r56600  
    184184    <hr class="wp-header-end">
    185185
    186     <div class="error hide-if-js">
    187         <p><?php _e( 'The Theme Installer screen requires JavaScript.' ); ?></p>
    188     </div>
     186    <?php
     187    wp_admin_notice(
     188        __( 'The Theme Installer screen requires JavaScript.' ),
     189        array(
     190            'additional_classes' => array( 'error', 'hide-if-js' ),
     191        )
     192    );
     193    ?>
    189194
    190195    <div class="upload-theme">
  • trunk/src/wp-admin/themes.php

    r56573 r56600  
    346346
    347347if ( $current_theme->errors() && ( ! is_multisite() || current_user_can( 'manage_network_themes' ) ) ) {
    348     echo '<div class="error"><p>' . __( 'Error:' ) . ' ' . $current_theme->errors()->get_error_message() . '</p></div>';
     348    wp_admin_notice(
     349        __( 'Error:' ) . ' ' . $current_theme->errors()->get_error_message(),
     350        array(
     351            'additional_classes' => array( 'error' ),
     352        )
     353    );
    349354}
    350355
     
    439444
    440445    <?php if ( $theme['hasUpdate'] ) : ?>
    441         <?php if ( $theme['updateResponse']['compatibleWP'] && $theme['updateResponse']['compatiblePHP'] ) : ?>
    442             <div class="update-message notice inline notice-warning notice-alt"><p>
    443                 <?php if ( $theme['hasPackage'] ) : ?>
    444                     <?php _e( 'New version available. <button class="button-link" type="button">Update now</button>' ); ?>
    445                 <?php else : ?>
    446                     <?php _e( 'New version available.' ); ?>
    447                 <?php endif; ?>
    448             </p></div>
    449         <?php else : ?>
    450             <div class="update-message notice inline notice-error notice-alt"><p>
    451                 <?php
    452                 if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) {
    453                     printf(
    454                         /* translators: %s: Theme name. */
    455                         __( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ),
    456                         $theme['name']
    457                     );
    458                     if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
    459                         printf(
    460                             /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
    461                             ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
    462                             self_admin_url( 'update-core.php' ),
    463                             esc_url( wp_get_update_php_url() )
    464                         );
    465                         wp_update_php_annotation( '</p><p><em>', '</em>' );
    466                     } elseif ( current_user_can( 'update_core' ) ) {
    467                         printf(
    468                             /* translators: %s: URL to WordPress Updates screen. */
    469                             ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
    470                             self_admin_url( 'update-core.php' )
    471                         );
    472                     } elseif ( current_user_can( 'update_php' ) ) {
    473                         printf(
    474                             /* translators: %s: URL to Update PHP page. */
    475                             ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
    476                             esc_url( wp_get_update_php_url() )
    477                         );
    478                         wp_update_php_annotation( '</p><p><em>', '</em>' );
    479                     }
    480                 } elseif ( ! $theme['updateResponse']['compatibleWP'] ) {
    481                     printf(
    482                         /* translators: %s: Theme name. */
    483                         __( 'There is a new version of %s available, but it does not work with your version of WordPress.' ),
    484                         $theme['name']
    485                     );
    486                     if ( current_user_can( 'update_core' ) ) {
    487                         printf(
    488                             /* translators: %s: URL to WordPress Updates screen. */
    489                             ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
    490                             self_admin_url( 'update-core.php' )
    491                         );
    492                     }
    493                 } elseif ( ! $theme['updateResponse']['compatiblePHP'] ) {
    494                     printf(
    495                         /* translators: %s: Theme name. */
    496                         __( 'There is a new version of %s available, but it does not work with your version of PHP.' ),
    497                         $theme['name']
    498                     );
    499                     if ( current_user_can( 'update_php' ) ) {
    500                         printf(
    501                             /* translators: %s: URL to Update PHP page. */
    502                             ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
    503                             esc_url( wp_get_update_php_url() )
    504                         );
    505                         wp_update_php_annotation( '</p><p><em>', '</em>' );
    506                     }
     446        <?php
     447        if ( $theme['updateResponse']['compatibleWP'] && $theme['updateResponse']['compatiblePHP'] ) :
     448            if ( $theme['hasPackage'] ) {
     449                $new_version_available = __( 'New version available. <button class="button-link" type="button">Update now</button>' );
     450            } else {
     451                $new_version_available = __( 'New version available.' );
     452            }
     453            wp_admin_notice(
     454                $new_version_available,
     455                array(
     456                    'type'               => 'warning',
     457                    'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ),
     458                )
     459            );
     460        else :
     461            $theme_update_error = '';
     462            if ( ! $theme['updateResponse']['compatibleWP'] && ! $theme['updateResponse']['compatiblePHP'] ) {
     463                $theme_update_error .= sprintf(
     464                    /* translators: %s: Theme name. */
     465                    __( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ),
     466                    $theme['name']
     467                );
     468                if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
     469                    $theme_update_error .= sprintf(
     470                        /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
     471                        ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
     472                        self_admin_url( 'update-core.php' ),
     473                        esc_url( wp_get_update_php_url() )
     474                    );
     475                    wp_update_php_annotation( '</p><p><em>', '</em>', false );
     476                } elseif ( current_user_can( 'update_core' ) ) {
     477                    $theme_update_error .= sprintf(
     478                        /* translators: %s: URL to WordPress Updates screen. */
     479                        ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     480                        self_admin_url( 'update-core.php' )
     481                    );
     482                } elseif ( current_user_can( 'update_php' ) ) {
     483                    $theme_update_error .= sprintf(
     484                        /* translators: %s: URL to Update PHP page. */
     485                        ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
     486                        esc_url( wp_get_update_php_url() )
     487                    );
     488                    wp_update_php_annotation( '</p><p><em>', '</em>', false );
    507489                }
    508                 ?>
    509             </p></div>
    510         <?php endif; ?>
    511     <?php endif; ?>
    512 
    513     <?php
     490            } elseif ( ! $theme['updateResponse']['compatibleWP'] ) {
     491                $theme_update_error .= sprintf(
     492                    /* translators: %s: Theme name. */
     493                    __( 'There is a new version of %s available, but it does not work with your version of WordPress.' ),
     494                    $theme['name']
     495                );
     496                if ( current_user_can( 'update_core' ) ) {
     497                    $theme_update_error .= sprintf(
     498                        /* translators: %s: URL to WordPress Updates screen. */
     499                        ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
     500                        self_admin_url( 'update-core.php' )
     501                    );
     502                }
     503            } elseif ( ! $theme['updateResponse']['compatiblePHP'] ) {
     504                $theme_update_error .= sprintf(
     505                    /* translators: %s: Theme name. */
     506                    __( 'There is a new version of %s available, but it does not work with your version of PHP.' ),
     507                    $theme['name']
     508                );
     509                if ( current_user_can( 'update_php' ) ) {
     510                    $theme_update_error .= sprintf(
     511                        /* translators: %s: URL to Update PHP page. */
     512                        ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
     513                        esc_url( wp_get_update_php_url() )
     514                    );
     515                    wp_update_php_annotation( '</p><p><em>', '</em>', false );
     516                }
     517            }
     518            wp_admin_notice(
     519                $theme_update_error,
     520                array(
     521                    'type'               => 'error',
     522                    'additional_classes' => array( 'notice-alt', 'inline', 'update-message' ),
     523                )
     524            );
     525        endif;
     526    endif;
     527
    514528    if ( ! $theme['compatibleWP'] || ! $theme['compatiblePHP'] ) {
    515529        $message = '';
     
    567581        );
    568582    }
    569     ?>
    570 
    571     <?php
     583
    572584    /* translators: %s: Theme name. */
    573585    $details_aria_label = sprintf( _x( 'View Theme Details for %s', 'theme' ), $theme['name'] );
     
    663675        <?php } ?>
    664676    </tr>
    665     <?php foreach ( $broken_themes as $broken_theme ) : ?>
     677    <?php
     678    foreach ( $broken_themes as $broken_theme ) :
     679        ?>
    666680        <tr>
    667681            <td><?php echo $broken_theme->get( 'Name' ) ? $broken_theme->display( 'Name' ) : esc_html( $broken_theme->get_stylesheet() ); ?></td>
     
    724738            ?>
    725739        </tr>
    726     <?php endforeach; ?>
     740        <?php
     741    endforeach;
     742    ?>
    727743</table>
    728744</div>
  • trunk/src/wp-admin/update-core.php

    r56570 r56600  
    10731073            $theme_updates = get_theme_updates();
    10741074            if ( ! empty( $theme_updates ) ) {
    1075                 echo '<div class="error"><p>';
    1076                 _e( 'Please select one or more themes to update.' );
    1077                 echo '</p></div>';
     1075                wp_admin_notice(
     1076                    __( 'Please select one or more themes to update.' ),
     1077                    array(
     1078                        'additional_classes' => array( 'error' ),
     1079                    )
     1080                );
    10781081            }
    10791082        } else {
    10801083            $plugin_updates = get_plugin_updates();
    10811084            if ( ! empty( $plugin_updates ) ) {
    1082                 echo '<div class="error"><p>';
    1083                 _e( 'Please select one or more plugins to update.' );
    1084                 echo '</p></div>';
     1085                wp_admin_notice(
     1086                    __( 'Please select one or more plugins to update.' ),
     1087                    array(
     1088                        'additional_classes' => array( 'error' ),
     1089                    )
     1090                );
    10851091            }
    10861092        }
  • trunk/src/wp-admin/user-edit.php

    r56573 r56600  
    245245
    246246        if ( isset( $errors ) && is_wp_error( $errors ) ) {
    247             ?>
    248             <div class="error">
    249                 <p><?php echo implode( "</p>\n<p>", $errors->get_error_messages() ); ?></p>
    250             </div>
    251             <?php
     247            wp_admin_notice(
     248                implode( "</p>\n<p>", $errors->get_error_messages() ),
     249                array(
     250                    'additional_classes' => array( 'error' ),
     251                )
     252            );
    252253        }
    253254        ?>
  • trunk/src/wp-admin/user-new.php

    r56573 r56600  
    382382</h1>
    383383
    384 <?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?>
    385     <div class="error">
    386         <ul>
    387         <?php
    388         foreach ( $errors->get_error_messages() as $err ) {
    389             echo "<li>$err</li>\n";
    390         }
    391         ?>
    392         </ul>
    393     </div>
    394     <?php
     384<?php
     385if ( isset( $errors ) && is_wp_error( $errors ) ) :
     386    $error_message = '';
     387    foreach ( $errors->get_error_messages() as $err ) {
     388        $error_message .= "<li>$err</li>\n";
     389    }
     390    wp_admin_notice(
     391        '<ul>' . $error_message . '</ul>',
     392        array(
     393            'additional_classes' => array( 'error' ),
     394            'paragraph_wrap'     => false,
     395        )
     396    );
    395397endif;
    396398
     
    409411?>
    410412
    411 <?php if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) : ?>
    412     <div class="error">
    413         <?php
    414         foreach ( $add_user_errors->get_error_messages() as $message ) {
    415             echo "<p>$message</p>";
    416         }
    417         ?>
    418     </div>
    419 <?php endif; ?>
     413<?php
     414if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) :
     415    $error_message = '';
     416    foreach ( $add_user_errors->get_error_messages() as $message ) {
     417        $error_message .= "<p>$message</p>\n";
     418    }
     419    wp_admin_notice(
     420        $error_message,
     421        array(
     422            'additional_classes' => array( 'error' ),
     423            'paragraph_wrap'     => false,
     424        )
     425    );
     426endif;
     427?>
    420428<div id="ajax-response"></div>
    421429
  • trunk/src/wp-admin/users.php

    r56573 r56600  
    340340        <h1><?php _e( 'Delete Users' ); ?></h1>
    341341
    342         <?php if ( isset( $_REQUEST['error'] ) ) : ?>
    343             <div class="error">
    344                 <p><strong><?php _e( 'Error:' ); ?></strong> <?php _e( 'Please select an option.' ); ?></p>
    345             </div>
    346         <?php endif; ?>
     342        <?php
     343        if ( isset( $_REQUEST['error'] ) ) :
     344            wp_admin_notice(
     345                '<strong>' . __( 'Error:' ) . '</strong> ' . __( 'Please select an option.' ),
     346                array(
     347                    'additional_classes' => array( 'error' ),
     348                )
     349            );
     350        endif;
     351        ?>
    347352
    348353        <?php if ( 1 === count( $all_user_ids ) ) : ?>
     
    743748        ?>
    744749
    745         <?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?>
    746             <div class="error">
    747                 <ul>
    748                 <?php
    749                 foreach ( $errors->get_error_messages() as $err ) {
    750                     echo "<li>$err</li>\n";
    751                 }
    752                 ?>
    753                 </ul>
    754             </div>
    755             <?php
     750        <?php
     751        if ( isset( $errors ) && is_wp_error( $errors ) ) :
     752            $error_message = '';
     753            foreach ( $errors->get_error_messages() as $err ) {
     754                $error_message .= "<li>$err</li>\n";
     755            }
     756            wp_admin_notice(
     757                '<ul>' . $error_message . '</ul>',
     758                array(
     759                    'additional_classes' => array( 'error' ),
     760                )
     761            );
    756762        endif;
    757763
Note: See TracChangeset for help on using the changeset viewer.