Remove redirect as it does not work with the background installer

This commit is contained in:
Gerhard Potgieter 2020-11-10 18:28:47 +02:00
parent b5fb7c0104
commit a0812d5009
2 changed files with 5 additions and 6 deletions

View File

@ -673,13 +673,13 @@ class WC_Admin_Addons {
public static function install_woocommerce_payments_addon() {
check_admin_referer( 'install-addon_woocommerce-payments' );
$services_plugin_id = 'woocommerce-payments';
$services_plugin = array(
$wcpay_plugin_id = 'woocommerce-payments';
$wcpay_plugin = array(
'name' => __( 'WooCommerce Payments', 'woocommerce' ),
'repo-slug' => 'woocommerce-payments',
);
WC_Install::background_installer( $services_plugin_id, $services_plugin, esc_url( admin_url( 'admin.php?page=wc-admin&path=%2Fpayments%2Fconnect' ) ) );
WC_Install::background_installer( $services_plugin_id, $wcpay_plugin );
wp_safe_redirect( remove_query_arg( array( 'install-addon', '_wpnonce' ) ) );
exit;

View File

@ -1398,12 +1398,11 @@ CREATE TABLE {$wpdb->prefix}wc_reserved_stock (
*
* @param string $plugin_to_install_id Plugin ID.
* @param array $plugin_to_install Plugin information.
* @param string $redirect Redirect URL.
*
* @throws Exception If unable to proceed with plugin installation.
* @since 2.6.0
*/
public static function background_installer( $plugin_to_install_id, $plugin_to_install, $redirect = '' ) {
public static function background_installer( $plugin_to_install_id, $plugin_to_install ) {
// Explicitly clear the event.
$args = func_get_args();
@ -1520,7 +1519,7 @@ CREATE TABLE {$wpdb->prefix}wc_reserved_stock (
if ( $activate ) {
try {
add_action( 'add_option_mailchimp_woocommerce_plugin_do_activation_redirect', array( __CLASS__, 'remove_mailchimps_redirect' ), 10, 2 );
$result = activate_plugin( $installed ? $installed_plugins[ $plugin_file ] : $plugin_slug . '/' . $plugin_file, $redirect );
$result = activate_plugin( $installed ? $installed_plugins[ $plugin_file ] : $plugin_slug . '/' . $plugin_file );
if ( is_wp_error( $result ) ) {
throw new Exception( $result->get_error_message() );