Skip to content

Commit 980704b

Browse files
committed
refactor: Replace hardcoded 'freemkit' prefix with dynamic prefix in wizard transient and option handling
- Use $this->prefix for show_wizard_activation_redirect transient instead of hardcoded 'freemkit' - Replace should_show_wizard logic with method call for consistency - Remove reset_wizard and trigger_wizard calls on restart to prevent re-showing setup nags if user exits rerun midway - Add explanatory comment for completion flag preservation behavior
1 parent eba3b0d commit 980704b

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

includes/admin/class-settings-wizard.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,7 @@ function (): bool {
313313
$page = isset( $_GET['page'] ) ? sanitize_key( (string) wp_unslash( $_GET['page'] ) ) : '';
314314

315315
return ! $this->is_wizard_completed()
316-
&& ! get_option( 'freemkit_wizard_notice_dismissed', false )
317-
&& ( get_transient( 'freemkit_show_wizard_activation_redirect' ) || get_option( 'freemkit_show_wizard', false ) )
316+
&& ( get_transient( $this->prefix . '_show_wizard_activation_redirect' ) || $this->should_show_wizard() )
318317
&& $this->page_slug !== $page;
319318
},
320319
),
@@ -346,11 +345,11 @@ public function maybe_redirect_after_activation(): void {
346345
return;
347346
}
348347

349-
if ( ! get_transient( 'freemkit_show_wizard_activation_redirect' ) ) {
348+
if ( ! get_transient( $this->prefix . '_show_wizard_activation_redirect' ) ) {
350349
return;
351350
}
352351

353-
delete_transient( 'freemkit_show_wizard_activation_redirect' );
352+
delete_transient( $this->prefix . '_show_wizard_activation_redirect' );
354353

355354
wp_safe_redirect( $this->get_wizard_url() );
356355
exit;
@@ -382,10 +381,10 @@ public function maybe_restart_wizard(): void {
382381
return;
383382
}
384383

385-
$this->reset_wizard();
386-
$this->trigger_wizard();
384+
// Do not reset completion flags on restart entry.
385+
// This prevents re-showing setup nags if user exits the rerun midway.
387386
update_option( "{$this->prefix}_wizard_current_step", 1 );
388-
delete_transient( 'freemkit_show_wizard_activation_redirect' );
387+
delete_transient( $this->prefix . '_show_wizard_activation_redirect' );
389388

390389
wp_safe_redirect( $this->get_wizard_url( array( 'step' => 1 ) ) );
391390
exit;

0 commit comments

Comments
 (0)