Skip to content

Commit

Permalink
Update onboarding to only disable after a successful API fetch when o…
Browse files Browse the repository at this point in the history
…nboarding has loaded.
  • Loading branch information
wpscholar committed Dec 12, 2023
1 parent 7a11320 commit fb8f4f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 1 addition & 4 deletions includes/LoginRedirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand All @@ -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 );
}

Expand Down
3 changes: 3 additions & 0 deletions includes/RestApi/FlowController.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace NewfoldLabs\WP\Module\Onboarding\RestApi;

use NewfoldLabs\WP\Module\Onboarding\Data\Options;
use NewfoldLabs\WP\Module\Onboarding\Permissions;
use NewfoldLabs\WP\Module\Onboarding\Data\Services\FlowService;
use NewfoldLabs\WP\Module\Onboarding\Services\PluginService;
Expand Down Expand Up @@ -109,6 +110,8 @@ 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 );

$flow_data = FlowService::update_data( $params );
if ( is_wp_error( $flow_data ) ) {
return $flow_data;
Expand Down

0 comments on commit fb8f4f2

Please sign in to comment.