Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix onboarding flow #392

Merged
merged 2 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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' ), '0' );

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