From fb8f4f2591fb073d6f2eea8bb262bf872f0e8f5a Mon Sep 17 00:00:00 2001 From: Micah Wood Date: Tue, 12 Dec 2023 16:35:06 -0500 Subject: [PATCH 1/2] Update onboarding to only disable after a successful API fetch when onboarding has loaded. --- includes/LoginRedirect.php | 5 +---- includes/RestApi/FlowController.php | 3 +++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/LoginRedirect.php b/includes/LoginRedirect.php index e3a711f89..ff2611f48 100644 --- a/includes/LoginRedirect.php +++ b/includes/LoginRedirect.php @@ -60,8 +60,6 @@ public static function filter_redirect( $original_redirect, $user ) { if ( '0' === $redirect_option ) { return $original_redirect; } elseif ( '1' === $redirect_option ) { - // Redirect to onboarding and, disable the redirect via option for any subsequent logins that may occur later. - self::disable_redirect(); return admin_url( '/index.php?page=' . WP_Admin::$slug ); } @@ -84,8 +82,7 @@ public static function filter_redirect( $original_redirect, $user ) { return $original_redirect; } - // Redirect to onboarding and, disable the redirect via option for any subsequent logins that may occur later. - self::disable_redirect(); + // Redirect to onboarding return admin_url( '/index.php?page=' . WP_Admin::$slug ); } diff --git a/includes/RestApi/FlowController.php b/includes/RestApi/FlowController.php index e03baeed6..e1f676dec 100644 --- a/includes/RestApi/FlowController.php +++ b/includes/RestApi/FlowController.php @@ -1,6 +1,7 @@ get_body(), true ); + update_option( Options::get_option_name( 'redirect' ), false ); + $flow_data = FlowService::update_data( $params ); if ( is_wp_error( $flow_data ) ) { return $flow_data; From 17a103dca3cc15d5154c208a0a6c9c5d024d02cf Mon Sep 17 00:00:00 2001 From: Micah Wood Date: Tue, 12 Dec 2023 16:39:51 -0500 Subject: [PATCH 2/2] Match exact logic from LoginRedirect.php `disable_redirect()` --- includes/RestApi/FlowController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/RestApi/FlowController.php b/includes/RestApi/FlowController.php index e1f676dec..f64209330 100644 --- a/includes/RestApi/FlowController.php +++ b/includes/RestApi/FlowController.php @@ -110,7 +110,7 @@ public function get() { public function save_onboarding_flow_data( \WP_REST_Request $request ) { $params = json_decode( $request->get_body(), true ); - update_option( Options::get_option_name( 'redirect' ), false ); + update_option( Options::get_option_name( 'redirect' ), '0' ); $flow_data = FlowService::update_data( $params ); if ( is_wp_error( $flow_data ) ) {