From 9f6f75bd8b9ad1bfa4905e7940268d2e1c854cfc Mon Sep 17 00:00:00 2001 From: Aaron Jorbin Date: Tue, 31 Jul 2018 14:52:28 +0000 Subject: [PATCH] Gutenberg: Restrict "Try Gutenberg" based on capability and gutenstatus When Gutenberg is either not installed, or not activated, only show the callout to users with the `install_plugins` capability. When Gutenberg is activated, expand that to include all users with the `edit_posts` capability. 4.9 branch commit. Props pento. Fixes #44680. Built from https://develop.svn.wordpress.org/branches/4.9@43544 git-svn-id: http://core.svn.wordpress.org/branches/4.9@43373 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/dashboard.php | 12 ++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 3794c3b08f..4e4d689920 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -24,6 +24,18 @@ function wp_dashboard_setup() { /* Register Widgets and Controls */ + // Try Gutenberg + + // If Gutenberg isn't activated, only show the panel to users who can install and activate it. + $plugins = get_plugins(); + if ( is_plugin_inactive( 'gutenberg/gutenberg.php' ) && ! current_user_can( 'install_plugins' ) ) { + remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' ); + } + // If Gutenberg is activated, only show it to users who can use it. + if ( is_plugin_active( 'gutenberg/gutenberg.php' ) && ! current_user_can( 'edit_posts' ) ) { + remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' ); + } + $response = wp_check_browser_version(); if ( $response && $response['upgrade'] ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index deacce1bc0..c42b4a35fd 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9.8-RC2-43539'; +$wp_version = '4.9.8-RC2-43544'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.