From ba28e41ee52d6ce2bed897472335f03af8079097 Mon Sep 17 00:00:00 2001 From: Jeff Stieler Date: Tue, 8 Oct 2019 12:32:44 -0700 Subject: [PATCH] Fix Facebook extension install from inbox (https://github.com/woocommerce/woocommerce-admin/pull/3010) * Restore FB extension to installation whitelist. Errantly removed in fe585aa2. * Fix FB extension installation from inbox. APIs have diverged. --- plugins/woocommerce-admin/src/Features/Onboarding.php | 1 + .../src/Notes/WC_Admin_Notes_Facebook_Extension.php | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/woocommerce-admin/src/Features/Onboarding.php b/plugins/woocommerce-admin/src/Features/Onboarding.php index 159c370178d..60af08843b9 100644 --- a/plugins/woocommerce-admin/src/Features/Onboarding.php +++ b/plugins/woocommerce-admin/src/Features/Onboarding.php @@ -383,6 +383,7 @@ class Onboarding { return apply_filters( 'woocommerce_onboarding_plugins_whitelist', array( + 'facebook-for-woocommerce' => 'facebook-for-woocommerce/facebook-for-woocommerce.php', 'jetpack' => 'jetpack/jetpack.php', 'woocommerce-services' => 'woocommerce-services/woocommerce-services.php', 'woocommerce-gateway-stripe' => 'woocommerce-gateway-stripe/woocommerce-gateway-stripe.php', diff --git a/plugins/woocommerce-admin/src/Notes/WC_Admin_Notes_Facebook_Extension.php b/plugins/woocommerce-admin/src/Notes/WC_Admin_Notes_Facebook_Extension.php index 8acb5a13d7b..28562fadd52 100644 --- a/plugins/woocommerce-admin/src/Notes/WC_Admin_Notes_Facebook_Extension.php +++ b/plugins/woocommerce-admin/src/Notes/WC_Admin_Notes_Facebook_Extension.php @@ -81,19 +81,22 @@ class WC_Admin_Notes_Facebook_Extension { /** * Install Facebook extension when note is actioned. + * + * @param WC_Admin_Note $note Note being acted upon. */ public function install_facebook_extension( $note ) { if ( self::NOTE_NAME === $note->get_name() ) { - $plugin = array( 'plugin' => 'facebook-for-woocommerce' ); - $installer = new \Automattic\WooCommerce\Admin\API\OnboardingPlugins(); - $result = $installer->install_plugin( $plugin ); + $install_request = array( 'plugin' => 'facebook-for-woocommerce' ); + $installer = new \Automattic\WooCommerce\Admin\API\OnboardingPlugins(); + $result = $installer->install_plugin( $install_request ); if ( is_wp_error( $result ) ) { // @todo Reset note actioned status? return; } - $installer->activate_plugin( $plugin ); + $activate_request = array( 'plugins' => 'facebook-for-woocommerce' ); + $installer->activate_plugins( $activate_request ); } } }