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.

Props pento.
Fixes #44680.

Built from https://develop.svn.wordpress.org/trunk@43543


git-svn-id: http://core.svn.wordpress.org/trunk@43372 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Aaron Jorbin 2018-07-31 14:42:29 +00:00
parent 58509ba12f
commit b27951eb85
2 changed files with 13 additions and 1 deletions

View File

@ -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'] ) {

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-alpha-43542';
$wp_version = '5.0-alpha-43543';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.