Setup wizard: keep user in setup wizard in case of Jetpack connection error.
This commit is contained in:
parent
b85d311dff
commit
325cea86c6
|
@ -1200,11 +1200,22 @@ class WC_Admin_Setup_Wizard {
|
||||||
$this->install_jetpack( true );
|
$this->install_jetpack( true );
|
||||||
|
|
||||||
if ( ! class_exists( 'Jetpack' ) ) {
|
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;
|
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' );
|
$connection_url = Jetpack::init()->build_connect_url( true, $redirect_url, 'woocommerce' );
|
||||||
|
|
||||||
wp_redirect( esc_url_raw( $connection_url ) );
|
wp_redirect( esc_url_raw( $connection_url ) );
|
||||||
|
|
Loading…
Reference in New Issue