From 3331c66b7de9329727e438728e6067ca397b54e7 Mon Sep 17 00:00:00 2001 From: Utsav Patel Date: Wed, 12 Jun 2024 10:56:19 +0530 Subject: [PATCH 1/3] Change site editor to edit site --- lib/compat/wordpress-6.6/admin-bar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compat/wordpress-6.6/admin-bar.php b/lib/compat/wordpress-6.6/admin-bar.php index 8892559cd7f62..7860b78341239 100644 --- a/lib/compat/wordpress-6.6/admin-bar.php +++ b/lib/compat/wordpress-6.6/admin-bar.php @@ -32,7 +32,7 @@ function gutenberg_admin_bar_edit_site_menu( $wp_admin_bar ) { $wp_admin_bar->add_node( array( 'id' => 'site-editor', - 'title' => __( 'Site Editor' ), + 'title' => __( 'Edit site' ), 'href' => add_query_arg( array( 'postType' => 'wp_template', From bc1a0e3d349a7d85fcb3fe60bd5eeb439c49909d Mon Sep 17 00:00:00 2001 From: Utsav Patel Date: Wed, 12 Jun 2024 12:40:47 +0530 Subject: [PATCH 2/3] changed multisite edit site to manage site --- lib/compat/wordpress-6.6/admin-bar.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/compat/wordpress-6.6/admin-bar.php b/lib/compat/wordpress-6.6/admin-bar.php index 7860b78341239..57a9446218d91 100644 --- a/lib/compat/wordpress-6.6/admin-bar.php +++ b/lib/compat/wordpress-6.6/admin-bar.php @@ -43,6 +43,18 @@ function gutenberg_admin_bar_edit_site_menu( $wp_admin_bar ) { ), ) ); + + if ( is_blog_admin() && is_multisite() && current_user_can( 'manage_sites' ) ) { + $wp_admin_bar->add_node( + array( + 'parent' => 'site-name', + 'id' => 'edit-site', + 'title' => __( 'Manage Site' ), + 'href' => network_admin_url( 'site-info.php?id=' . get_current_blog_id() ), + ) + ); + } + } remove_action( 'admin_bar_menu', 'wp_admin_bar_edit_site_menu', 40 ); add_action( 'admin_bar_menu', 'gutenberg_admin_bar_edit_site_menu', 41 ); From c96b20f4b723fb280273ba83c7f529839d69c18e Mon Sep 17 00:00:00 2001 From: Utsav Patel Date: Wed, 12 Jun 2024 13:48:06 +0530 Subject: [PATCH 3/3] return early if in multisite --- lib/compat/wordpress-6.6/admin-bar.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/compat/wordpress-6.6/admin-bar.php b/lib/compat/wordpress-6.6/admin-bar.php index 57a9446218d91..b7a77faebea72 100644 --- a/lib/compat/wordpress-6.6/admin-bar.php +++ b/lib/compat/wordpress-6.6/admin-bar.php @@ -25,7 +25,7 @@ function gutenberg_admin_bar_edit_site_menu( $wp_admin_bar ) { } // Don't show for users who can't edit theme options or when in the admin. - if ( ! current_user_can( 'edit_theme_options' ) || is_admin() ) { + if ( ! current_user_can( 'edit_theme_options' ) || is_admin() || ( is_blog_admin() && is_multisite() && current_user_can( 'manage_sites' ) ) ) { return; } @@ -43,18 +43,6 @@ function gutenberg_admin_bar_edit_site_menu( $wp_admin_bar ) { ), ) ); - - if ( is_blog_admin() && is_multisite() && current_user_can( 'manage_sites' ) ) { - $wp_admin_bar->add_node( - array( - 'parent' => 'site-name', - 'id' => 'edit-site', - 'title' => __( 'Manage Site' ), - 'href' => network_admin_url( 'site-info.php?id=' . get_current_blog_id() ), - ) - ); - } - } remove_action( 'admin_bar_menu', 'wp_admin_bar_edit_site_menu', 40 ); add_action( 'admin_bar_menu', 'gutenberg_admin_bar_edit_site_menu', 41 );