Make WordPress Core


Ignore:
Timestamp:
07/18/2018 06:41:07 AM (5 years ago)
Author:
pento
Message:

Dashboard: Introduce the "Try Gutenberg" callout.

To encourage folks to prepare for Gutenberg, this new Dashboard box allows site users to easily install and try the Gutenberg plugin now, or to install the Classic Editor plugin before WordPress 5.0 is released.

Props pento, melchoyce, joen, karmatosed, joemcgill, SergeyBiryukov, jorbin, bph, Clorith, afercia, chanthaboune, chrislema, kjellr, matveb, michelleweber.
Fixes #41316.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9/src/wp-admin/includes/class-wp-screen.php

    r42883 r43502  
    10211021                } else {
    10221022                    $welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
    1023                     if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) {
     1023                    if ( '' === $welcome_checked ) {
     1024                        $welcome_checked = '1';
     1025                    }
     1026                    if ( '2' === $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) {
    10241027                        $welcome_checked = false;
    10251028                    }
     
    10281031                echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />';
    10291032                echo _x( 'Welcome', 'Welcome panel' ) . "</label>\n";
     1033            }
     1034
     1035            if ( 'dashboard' === $this->id && has_action( 'try_gutenberg_panel' ) ) {
     1036                if ( isset( $_GET['try_gutenberg'] ) ) {
     1037                    $try_gutenberg_checked = empty( $_GET['try_gutenberg'] ) ? 0 : 1;
     1038                    update_user_meta( get_current_user_id(), 'show_try_gutenberg_panel', $try_gutenberg_checked );
     1039                } else {
     1040                    $try_gutenberg_checked = get_user_meta( get_current_user_id(), 'show_try_gutenberg_panel', true );
     1041                    if ( '' === $try_gutenberg_checked ) {
     1042                        $try_gutenberg_checked = '1';
     1043                    }
     1044                    if ( '2' === $try_gutenberg_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) {
     1045                        $try_gutenberg_checked = false;
     1046                    }
     1047                }
     1048                echo '<label for="wp_try_gutenberg_panel-hide">';
     1049                echo '<input type="checkbox" id="wp_try_gutenberg_panel-hide"' . checked( (bool) $try_gutenberg_checked, true, false ) . ' />';
     1050                echo __( 'New Editor' ) . "</label>\n";
    10301051            }
    10311052        ?>
Note: See TracChangeset for help on using the changeset viewer.