Skip to content

Commit

Permalink
Removes notice after upgrade (#96)
Browse files Browse the repository at this point in the history
Remove the after-upgrade notice from the "What's New" screen.
Fixes #95.
  • Loading branch information
jchristopher authored and azaozz committed May 8, 2019
1 parent f59ee97 commit 7898fbe
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions classic-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ public static function init_actions() {
}

if ( $block_editor ) {
// Show warning on the "What's New" screen (about.php).
add_action( 'all_admin_notices', array( __CLASS__, 'notice_after_upgrade' ) );
// Move the Privacy Page notice back under the title.
add_action( 'admin_init', array( __CLASS__, 'on_admin_init' ) );
}
Expand Down Expand Up @@ -508,44 +506,6 @@ public static function save_network_settings() {
}
}

public static function notice_after_upgrade() {
global $pagenow;
$settings = self::get_settings();

if (
$pagenow !== 'about.php' ||
$settings['hide-settings-ui'] ||
$settings['editor'] === 'block' ||
$settings['allow-users'] ||
! current_user_can( 'edit_posts' )
) {
// No need to show when the user cannot edit posts,
// the settings are preset from another plugin,
// or when not replacing the Block Editor.
return;
}

$message = __( 'The Classic Editor plugin prevents use of the new Block Editor.', 'classic-editor' );

if ( current_user_can( 'manage_options' ) ) {
if ( is_network_admin() ) {
$url = 'settings.php#classic-editor-options';
} else {
$url = 'options-writing.php#classic-editor-options';
}

$message .= ' ' . sprintf( __( 'Change the %1$sClassic Editor settings%2$s.', 'classic-editor' ), sprintf( '<a href="%s">', $url ), '</a>' );
}

$margin = is_rtl() ? 'margin: 1em 0 0 160px;' : 'margin: 1em 160px 0 0;';

?>
<div id="message" class="notice-warning notice" style="display: inline-block !important; <?php echo $margin; ?>">
<p><?php echo $message; ?></p>
</div>
<?php
}

/**
* Add a hidden field in edit-form-advanced.php
* to help redirect back to the Classic Editor on saving.
Expand Down

0 comments on commit 7898fbe

Please sign in to comment.