From cde1ad471b909188a85d396324ac0eafcdea0c12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Adolfo=20Lucha=20Garc=C3=ADa?= Date: Fri, 10 May 2024 16:37:59 +0200 Subject: [PATCH 1/3] Entrepreneur my home goes to Calypso instead --- .sshyncignore | 7 ++++++ ...wc-calypso-bridge-ecommerce-admin-menu.php | 22 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 .sshyncignore diff --git a/.sshyncignore b/.sshyncignore new file mode 100644 index 00000000..353e57b0 --- /dev/null +++ b/.sshyncignore @@ -0,0 +1,7 @@ +.git +node_modules/ +tests/ +vendor/ +.cache/ +.idea +.config diff --git a/includes/class-wc-calypso-bridge-ecommerce-admin-menu.php b/includes/class-wc-calypso-bridge-ecommerce-admin-menu.php index 13647da9..f385570a 100644 --- a/includes/class-wc-calypso-bridge-ecommerce-admin-menu.php +++ b/includes/class-wc-calypso-bridge-ecommerce-admin-menu.php @@ -262,6 +262,18 @@ public function add_my_home_menu() { 'wpcom-hosting-menu', esc_url( "https://wordpress.com/home/{$this->domain}" ) ); + + // If we have entrepreneur plan, we change the url of home + if ( $this->has_entrepreneur_plan() ) { + $this->update_menu( + 'index.php', + 'https://wordpress.com/home/' . $this->domain . '?flags=entrepreneur-my-home', + $label, + 'edit_posts', + 'dashicons-admin-home' + ); + remove_submenu_page( 'index.php', 'admin.php?page=wc-admin' ); + } } /** @@ -644,4 +656,14 @@ public function add_jetpack_menu() { } ); } } + + /** + * Check if the site has Entrepreneur plan + * + * @return bool + */ + protected function has_entrepreneur_plan() { + $current_plan = get_option( 'jetpack_active_plan', array() ); + return ! empty( $current_plan ) && 'ecommerce-bundle' === $current_plan['product_slug']; + } } From 25ea2116d8e78338603a1604e3a22a5eb7268ed1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Adolfo=20Lucha=20Garc=C3=ADa?= Date: Mon, 13 May 2024 12:39:18 +0200 Subject: [PATCH 2/3] Removed sshyncignore --- .sshyncignore | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 .sshyncignore diff --git a/.sshyncignore b/.sshyncignore deleted file mode 100644 index 353e57b0..00000000 --- a/.sshyncignore +++ /dev/null @@ -1,7 +0,0 @@ -.git -node_modules/ -tests/ -vendor/ -.cache/ -.idea -.config From 4c6567de6556a2b7b5694a8cb790bdfb27967219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Adolfo=20Lucha=20Garc=C3=ADa?= Date: Tue, 14 May 2024 17:19:08 +0200 Subject: [PATCH 3/3] Checking against entrepreneur plans --- ...lass-wc-calypso-bridge-ecommerce-admin-menu.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/includes/class-wc-calypso-bridge-ecommerce-admin-menu.php b/includes/class-wc-calypso-bridge-ecommerce-admin-menu.php index f385570a..4fd26ffb 100644 --- a/includes/class-wc-calypso-bridge-ecommerce-admin-menu.php +++ b/includes/class-wc-calypso-bridge-ecommerce-admin-menu.php @@ -664,6 +664,18 @@ public function add_jetpack_menu() { */ protected function has_entrepreneur_plan() { $current_plan = get_option( 'jetpack_active_plan', array() ); - return ! empty( $current_plan ) && 'ecommerce-bundle' === $current_plan['product_slug']; + if ( empty( $current_plan ) ) { + return false; + } + + $entrepreneur_plans = [ + 'ecommerce-bundle-monthly', + 'ecommerce-bundle', + 'ecommerce-bundle-2y', + 'ecommerce-bundle-3y', + 'ecommerce-trial-bundle-monthly', + ]; + + return in_array( $current_plan['product_slug'], $entrepreneur_plans, true ); } }