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.
This commit is contained in:
parent
431e465893
commit
ba28e41ee5
|
@ -383,6 +383,7 @@ class Onboarding {
|
||||||
return apply_filters(
|
return apply_filters(
|
||||||
'woocommerce_onboarding_plugins_whitelist',
|
'woocommerce_onboarding_plugins_whitelist',
|
||||||
array(
|
array(
|
||||||
|
'facebook-for-woocommerce' => 'facebook-for-woocommerce/facebook-for-woocommerce.php',
|
||||||
'jetpack' => 'jetpack/jetpack.php',
|
'jetpack' => 'jetpack/jetpack.php',
|
||||||
'woocommerce-services' => 'woocommerce-services/woocommerce-services.php',
|
'woocommerce-services' => 'woocommerce-services/woocommerce-services.php',
|
||||||
'woocommerce-gateway-stripe' => 'woocommerce-gateway-stripe/woocommerce-gateway-stripe.php',
|
'woocommerce-gateway-stripe' => 'woocommerce-gateway-stripe/woocommerce-gateway-stripe.php',
|
||||||
|
|
|
@ -81,19 +81,22 @@ class WC_Admin_Notes_Facebook_Extension {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install Facebook extension when note is actioned.
|
* Install Facebook extension when note is actioned.
|
||||||
|
*
|
||||||
|
* @param WC_Admin_Note $note Note being acted upon.
|
||||||
*/
|
*/
|
||||||
public function install_facebook_extension( $note ) {
|
public function install_facebook_extension( $note ) {
|
||||||
if ( self::NOTE_NAME === $note->get_name() ) {
|
if ( self::NOTE_NAME === $note->get_name() ) {
|
||||||
$plugin = array( 'plugin' => 'facebook-for-woocommerce' );
|
$install_request = array( 'plugin' => 'facebook-for-woocommerce' );
|
||||||
$installer = new \Automattic\WooCommerce\Admin\API\OnboardingPlugins();
|
$installer = new \Automattic\WooCommerce\Admin\API\OnboardingPlugins();
|
||||||
$result = $installer->install_plugin( $plugin );
|
$result = $installer->install_plugin( $install_request );
|
||||||
|
|
||||||
if ( is_wp_error( $result ) ) {
|
if ( is_wp_error( $result ) ) {
|
||||||
// @todo Reset note actioned status?
|
// @todo Reset note actioned status?
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$installer->activate_plugin( $plugin );
|
$activate_request = array( 'plugins' => 'facebook-for-woocommerce' );
|
||||||
|
$installer->activate_plugins( $activate_request );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue