Make WordPress Core

Changeset 45117


Ignore:
Timestamp:
04/05/2019 04:59:34 PM (6 years ago)
Author:
flixos90
Message:

Administration: Improve user experience and clarify when in recovery mode.

This changeset introduces several changes around usability when recovery mode is active:

  • Display a notice in the admin clarifying that the user is in recovery mode.
  • Use a highlight color for the admin bar link to exit recovery mode.
  • Exit recovery mode automatically when logging out.
  • Include a recovery mode indicator in the title tag.

Props aandrewdixon, azaozz, dhanukanuwan, flixos90, henrywright, karmatosed, mapk, melchoyce, spacedmonkey, TimothyBlynJacobs, tinkerbelly.
See #46608.

Location:
trunk/src
Files:
8 edited

Legend:

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

    r44639 r45117  
    5151    /* translators: Admin screen title. 1: Admin screen name, 2: Network or site name */
    5252    $admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $title, $admin_title );
     53}
     54
     55if ( wp_is_recovery_mode() ) {
     56    /* translators: %s: Admin screen title. */
     57    $admin_title = sprintf( __( '%s — Recovery Mode' ), $admin_title );
    5358}
    5459
  • trunk/src/wp-admin/css/colors/_admin.scss

    r43019 r45117  
    349349}
    350350
     351/* Admin Bar: recovery mode */
     352
     353#wpadminbar #wp-admin-bar-recovery-mode {
     354    color: $adminbar-recovery-exit-text;
     355    background-color: $adminbar-recovery-exit-background;
     356}
     357
     358#wpadminbar #wp-admin-bar-recovery-mode .ab-item,
     359#wpadminbar #wp-admin-bar-recovery-mode a.ab-item {
     360    color: $adminbar-recovery-exit-text;
     361}
     362
     363#wpadminbar .ab-top-menu > #wp-admin-bar-recovery-mode.hover >.ab-item,
     364#wpadminbar.nojq .quicklinks .ab-top-menu > #wp-admin-bar-recovery-mode > .ab-item:focus,
     365#wpadminbar:not(.mobile) .ab-top-menu > #wp-admin-bar-recovery-mode:hover > .ab-item,
     366#wpadminbar:not(.mobile) .ab-top-menu > #wp-admin-bar-recovery-mode > .ab-item:focus {
     367    color: $adminbar-recovery-exit-text;
     368    background-color: $adminbar-recovery-exit-background-alt;
     369}
     370
    351371/* Admin Bar: my account */
    352372
  • trunk/src/wp-admin/css/colors/_variables.scss

    r32051 r45117  
    5656$adminbar-input-background: lighten( $menu-background, 7% ) !default;
    5757
     58$adminbar-recovery-exit-text: $menu-bubble-text !default;
     59$adminbar-recovery-exit-background: $menu-bubble-background !default;
     60$adminbar-recovery-exit-background-alt: mix(black, $adminbar-recovery-exit-background, 10%) !default;
     61
    5862$menu-customizer-text: mix( $base-color, $text-color, 40% ) !default;
  • trunk/src/wp-admin/includes/admin-filters.php

    r44973 r45117  
    121121add_action( 'admin_notices', 'paused_themes_notice', 5 );
    122122add_action( 'admin_notices', 'maintenance_nag', 10 );
     123add_action( 'admin_notices', 'wp_recovery_mode_nag', 1 );
    123124
    124125add_filter( 'update_footer', 'core_update_footer' );
  • trunk/src/wp-admin/includes/update.php

    r44980 r45117  
    830830    <?php
    831831}
     832
     833/**
     834 * Displays a notice when the user is in recovery mode.
     835 *
     836 * @since 5.2.0
     837 */
     838function wp_recovery_mode_nag() {
     839    if ( ! wp_is_recovery_mode() ) {
     840        return;
     841    }
     842
     843    ?>
     844    <div class="notice notice-info">
     845        <p>
     846            <?php esc_html_e( 'You are in recovery mode. This means there may be an error with a theme or plugin. To exit recovery mode, log out or use the Exit button.' ); ?>
     847        </p>
     848    </div>
     849    <?php
     850}
  • trunk/src/wp-includes/class-wp-recovery-mode.php

    r44973 r45117  
    8383        $this->is_initialized = true;
    8484
     85        add_action( 'wp_logout', array( $this, 'exit_recovery_mode' ) );
    8586        add_action( 'login_form_' . self::EXIT_ACTION, array( $this, 'handle_exit_recovery_mode' ) );
    8687
  • trunk/src/wp-includes/css/admin-bar.css

    r44793 r45117  
    383383#wpadminbar ul li:last-child .ab-item {
    384384    box-shadow: none;
     385}
     386
     387/**
     388 * Recovery Mode
     389 */
     390#wpadminbar #wp-admin-bar-recovery-mode {
     391    color: #fff;
     392    background-color: #ca4a1f;
     393}
     394
     395#wpadminbar .ab-top-menu > #wp-admin-bar-recovery-mode.hover >.ab-item,
     396#wpadminbar.nojq .quicklinks .ab-top-menu > #wp-admin-bar-recovery-mode > .ab-item:focus,
     397#wpadminbar:not(.mobile) .ab-top-menu > #wp-admin-bar-recovery-mode:hover > .ab-item,
     398#wpadminbar:not(.mobile) .ab-top-menu > #wp-admin-bar-recovery-mode > .ab-item:focus {
     399    color: #fff;
     400    background-color: #c0461e;
    385401}
    386402
  • trunk/src/wp-login.php

    r44973 r45117  
    6464    /* translators: Login screen title. 1: Login screen name, 2: Network or site name */
    6565    $login_title = sprintf( __( '%1$s &lsaquo; %2$s &#8212; WordPress' ), $title, $login_title );
     66
     67    if ( wp_is_recovery_mode() ) {
     68        /* translators: %s: Login screen title. */
     69        $login_title = sprintf( __( '%s &#8212; Recovery Mode' ), $login_title );
     70    }
    6671
    6772    /**
Note: See TracChangeset for help on using the changeset viewer.