Setup wizard: keep user in setup wizard in case of Jetpack connection error.

This commit is contained in:
Jeff Stieler 2017-09-10 12:24:47 -06:00
parent b85d311dff
commit 325cea86c6
1 changed files with 13 additions and 2 deletions

View File

@ -1200,11 +1200,22 @@ class WC_Admin_Setup_Wizard {
$this->install_jetpack( true );
if ( ! class_exists( 'Jetpack' ) ) {
wp_redirect( esc_url_raw( add_query_arg( 'error', true ) ) );
wp_redirect( esc_url_raw( add_query_arg( 'activate_error', 'install' ) ) );
exit;
}
$redirect_url = site_url( add_query_arg( 'from', 'wpcom' ) );
Jetpack::maybe_set_version_option();
$registered = Jetpack::try_registration();
if ( is_wp_error( $registered ) ) {
wp_redirect( esc_url_raw( add_query_arg( 'activate_error', 'register' ) ) );
exit;
}
$redirect_url = site_url( add_query_arg( array(
'from' => 'wpcom',
'activate_error' => false,
) ) );
$connection_url = Jetpack::init()->build_connect_url( true, $redirect_url, 'woocommerce' );
wp_redirect( esc_url_raw( $connection_url ) );