From 222c80747bf43d5eafd5762944f5060903fe0300 Mon Sep 17 00:00:00 2001 From: Gabriel Demichelis Date: Mon, 22 Apr 2024 02:41:14 -0300 Subject: [PATCH] Monetize: Move menu item under the Jetpack menu for all Classic interface users (#36995) * Monetize: Move to Jetpack menu to all Classic interface users * changelog --- .../monetize-move-under-jetpack-menu-to-all-classic-users | 4 ++++ .../src/features/wpcom-site-menu/wpcom-site-menu.php | 7 ++++++- .../update-monetize-to-all-classic-interface-users | 4 ++++ .../modules/masterbar/admin-menu/class-admin-menu.php | 4 +++- 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/monetize-move-under-jetpack-menu-to-all-classic-users create mode 100644 projects/plugins/jetpack/changelog/update-monetize-to-all-classic-interface-users diff --git a/projects/packages/jetpack-mu-wpcom/changelog/monetize-move-under-jetpack-menu-to-all-classic-users b/projects/packages/jetpack-mu-wpcom/changelog/monetize-move-under-jetpack-menu-to-all-classic-users new file mode 100644 index 0000000000000..c4524c422fdee --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/monetize-move-under-jetpack-menu-to-all-classic-users @@ -0,0 +1,4 @@ +Significance: minor +Type: changed + +Monetize: Move menu item under Jetpack menu for all Classic interface users diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-site-menu/wpcom-site-menu.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-site-menu/wpcom-site-menu.php index df57af0430cfe..b8dc31e2562e9 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-site-menu/wpcom-site-menu.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-site-menu/wpcom-site-menu.php @@ -11,6 +11,7 @@ use Automattic\Jetpack\Jetpack_Mu_Wpcom; use Automattic\Jetpack\Redirect; use Automattic\Jetpack\Status; +use Automattic\Jetpack\Status\Host; /** * Check if the current user has a WordPress.com account connected. @@ -217,7 +218,11 @@ function add_all_sites_menu_to_masterbar( $wp_admin_bar ) { * Add the WordPress.com submenu items related to Jetpack under the Jetpack menu on the wp-admin sidebar. */ function wpcom_add_jetpack_menu_item() { - if ( ! function_exists( 'wpcom_is_nav_redesign_enabled' ) || ! wpcom_is_nav_redesign_enabled() ) { + /* + * Do not display any menu on WoA and WordPress.com Simple sites (unless Classic wp-admin is enabled). + * They already get a menu item under Users via nav-unification. + */ + if ( ( new Host() )->is_wpcom_platform() && get_option( 'wpcom_admin_interface' ) !== 'wp-admin' ) { return; } diff --git a/projects/plugins/jetpack/changelog/update-monetize-to-all-classic-interface-users b/projects/plugins/jetpack/changelog/update-monetize-to-all-classic-interface-users new file mode 100644 index 0000000000000..3fe20d4dae0a5 --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-monetize-to-all-classic-interface-users @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Monetize: Move menu item under Jetpack menu for all Classic interface users diff --git a/projects/plugins/jetpack/modules/masterbar/admin-menu/class-admin-menu.php b/projects/plugins/jetpack/modules/masterbar/admin-menu/class-admin-menu.php index 14812aecfc5bb..4a22c45077bed 100644 --- a/projects/plugins/jetpack/modules/masterbar/admin-menu/class-admin-menu.php +++ b/projects/plugins/jetpack/modules/masterbar/admin-menu/class-admin-menu.php @@ -350,7 +350,9 @@ public function add_tools_menu() { $this->hide_submenu_page( 'tools.php', 'delete-blog' ); add_submenu_page( 'tools.php', esc_attr__( 'Marketing', 'jetpack' ), __( 'Marketing', 'jetpack' ), 'publish_posts', 'https://wordpress.com/marketing/tools/' . $this->domain, null, 0 ); - add_submenu_page( 'tools.php', esc_attr__( 'Monetize', 'jetpack' ), __( 'Monetize', 'jetpack' ), 'manage_options', 'https://wordpress.com/earn/' . $this->domain, null, 1 ); + if ( ! $this->use_wp_admin_interface() ) { + add_submenu_page( 'tools.php', esc_attr__( 'Monetize', 'jetpack' ), __( 'Monetize', 'jetpack' ), 'manage_options', 'https://wordpress.com/earn/' . $this->domain, null, 1 ); + } } /**