From f77b0d7d53749ecd678ae73f1b569d20a9733d61 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Wed, 16 Aug 2023 16:42:04 -0400 Subject: [PATCH 1/3] hook into activated plugin and check if woo or jp --- inc/jetpack.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/inc/jetpack.php b/inc/jetpack.php index 6c076047a..5157f9fd5 100644 --- a/inc/jetpack.php +++ b/inc/jetpack.php @@ -55,4 +55,21 @@ function jetpack_construction() { return true; } } -add_filter( 'jetpack_is_under_construction_plugin', __NAMESPACE__ . '\\jetpack_construction' ); \ No newline at end of file +add_filter( 'jetpack_is_under_construction_plugin', __NAMESPACE__ . '\\jetpack_construction' ); + +/** + * Enable Sharing with Jetpack and WooCommerce + */ +function plugin_activated( $plugin, $network_activation ) { + switch( $plugin ) { + case 'woocommerce/woocommerce.php': + // Enable the usage tracking option by default https://woocommerce.com/usage-tracking/ + update_option( 'woocommerce_allow_tracking', 'yes' ); + break; + case 'jetpack/jetpack.php': + // set the privacy settings to allow sharing information with analytics by default https://automattic.com/cookies/ + break; + } +} + +add_action( 'activated_plugin', __NAMESPACE__ . '\\plugin_activated', 10, 2 ); \ No newline at end of file From ba470430699d18402e5a4e69b704cdc838c729c7 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Fri, 18 Aug 2023 17:15:38 -0400 Subject: [PATCH 2/3] move hook to partners file and only check woo --- inc/jetpack.php | 17 ----------------- inc/partners.php | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/inc/jetpack.php b/inc/jetpack.php index 5157f9fd5..a1eee70df 100644 --- a/inc/jetpack.php +++ b/inc/jetpack.php @@ -56,20 +56,3 @@ function jetpack_construction() { } } add_filter( 'jetpack_is_under_construction_plugin', __NAMESPACE__ . '\\jetpack_construction' ); - -/** - * Enable Sharing with Jetpack and WooCommerce - */ -function plugin_activated( $plugin, $network_activation ) { - switch( $plugin ) { - case 'woocommerce/woocommerce.php': - // Enable the usage tracking option by default https://woocommerce.com/usage-tracking/ - update_option( 'woocommerce_allow_tracking', 'yes' ); - break; - case 'jetpack/jetpack.php': - // set the privacy settings to allow sharing information with analytics by default https://automattic.com/cookies/ - break; - } -} - -add_action( 'activated_plugin', __NAMESPACE__ . '\\plugin_activated', 10, 2 ); \ No newline at end of file diff --git a/inc/partners.php b/inc/partners.php index a35712f97..2bc60e782 100644 --- a/inc/partners.php +++ b/inc/partners.php @@ -32,3 +32,22 @@ function aioseo_upgrade_affiliate_link( $url ) { } add_filter( 'aioseo_upgrade_link', __NAMESPACE__ . '\\aioseo_upgrade_affiliate_link' ); + +/** + * Enable Sharing with WooCommerce + * + * @param string $plugin the plugin + * @param boolean $network_activation flag is network activated + * + * @return void + */ +function plugin_activated( $plugin, $network_activation ) { + switch( $plugin ) { + case 'woocommerce/woocommerce.php': + // Enable the usage tracking option by default https://woocommerce.com/usage-tracking/ + update_option( 'woocommerce_allow_tracking', 'yes' ); + break; + } +} + +add_action( 'activated_plugin', __NAMESPACE__ . '\\plugin_activated', 10, 2 ); \ No newline at end of file From 7d9db533e3afddc05ba769e3a54040212bda4c60 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Fri, 18 Aug 2023 17:18:12 -0400 Subject: [PATCH 3/3] remove stray newline --- inc/jetpack.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/jetpack.php b/inc/jetpack.php index a1eee70df..6c076047a 100644 --- a/inc/jetpack.php +++ b/inc/jetpack.php @@ -55,4 +55,4 @@ function jetpack_construction() { return true; } } -add_filter( 'jetpack_is_under_construction_plugin', __NAMESPACE__ . '\\jetpack_construction' ); +add_filter( 'jetpack_is_under_construction_plugin', __NAMESPACE__ . '\\jetpack_construction' ); \ No newline at end of file