Skip to content

Commit 4157bd4

Browse files
committed
reverse onboarding filter logic
1 parent e442d25 commit 4157bd4

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

classes/class-onboard-wizard.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,22 @@ public function maybe_register_popover_hooks() {
5050
// 1. Privacy not yet accepted (new install, non-branded).
5151
// 2. Onboarding already in progress.
5252
// 3. Branded site (privacy auto-accepted, but still needs onboarding).
53-
$is_branded = 0 !== (int) \progress_planner()->get_ui__branding()->get_branding_id();
54-
$skip_onboarding = \progress_planner()->is_privacy_policy_accepted()
55-
&& ! \get_option( 'prpl_onboard_progress', false )
56-
&& ! $is_branded;
53+
$is_branded = 0 !== (int) \progress_planner()->get_ui__branding()->get_branding_id();
54+
$show_onboarding = ! \progress_planner()->is_privacy_policy_accepted()
55+
|| \get_option( 'prpl_onboard_progress', false )
56+
|| $is_branded;
5757

5858
/**
59-
* Filter whether to skip the onboarding wizard.
59+
* Filter whether to show the onboarding wizard.
6060
*
6161
* Hosting integrations can use this filter to force showing
6262
* or hiding the onboarding wizard.
6363
*
64-
* @param bool $skip_onboarding Whether to skip showing the onboarding wizard.
64+
* @param bool $show_onboarding Whether to show the onboarding wizard.
6565
*/
66-
$skip_onboarding = \apply_filters( 'progress_planner_skip_onboarding', $skip_onboarding );
66+
$show_onboarding = \apply_filters( 'progress_planner_show_onboarding', $show_onboarding );
6767

68-
if ( $skip_onboarding ) {
68+
if ( ! $show_onboarding ) {
6969
return;
7070
}
7171

tests/phpunit/test-class-onboard-wizard.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,30 +336,30 @@ public function test_rest_pre_insert_attachment_passes_through_non_prpl() {
336336
}
337337

338338
/**
339-
* Test skip_onboarding filter.
339+
* Test show_onboarding filter.
340340
*
341341
* @return void
342342
*/
343-
public function test_skip_onboarding_filter() {
343+
public function test_show_onboarding_filter() {
344344
// Set admin user.
345345
\wp_set_current_user( $this->admin_user_id );
346346

347347
// Ensure privacy is not accepted (would normally show onboarding).
348348
\delete_option( 'progress_planner_license_key' );
349349

350-
// Add filter to skip onboarding.
351-
\add_filter( 'progress_planner_skip_onboarding', '__return_true' );
350+
// Add filter to hide onboarding.
351+
\add_filter( 'progress_planner_show_onboarding', '__return_false' );
352352

353353
$wizard = new Onboard_Wizard();
354354
$wizard->maybe_register_popover_hooks();
355355

356-
// Footer hooks should NOT be registered when filter skips onboarding.
356+
// Footer hooks should NOT be registered when filter hides onboarding.
357357
$this->assertFalse(
358358
\has_action( 'wp_footer', [ $wizard, 'add_popover' ] )
359359
);
360360

361361
// Remove filter.
362-
\remove_filter( 'progress_planner_skip_onboarding', '__return_true' );
362+
\remove_filter( 'progress_planner_show_onboarding', '__return_false' );
363363
}
364364

365365
/**

0 commit comments

Comments
 (0)