From 91abae23527f8394955a825a764d1a99d5d4cd34 Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Wed, 21 Jan 2026 16:43:33 +0100 Subject: [PATCH 1/4] plan --- .planning/revert-onboarding-plan.md | 289 ++++++++++++++++++++++++++++ 1 file changed, 289 insertions(+) create mode 100644 .planning/revert-onboarding-plan.md diff --git a/.planning/revert-onboarding-plan.md b/.planning/revert-onboarding-plan.md new file mode 100644 index 000000000..169aee183 --- /dev/null +++ b/.planning/revert-onboarding-plan.md @@ -0,0 +1,289 @@ +# Plan: Revert New Onboarding (PR #714) and Preserve Work + +## Overview + +This plan describes how to revert PR #714 (New User Onboarding) on the `develop` branch while preserving all the new onboarding work on a separate branch. + +**PR #714 Details:** +- Merged: December 16, 2025 +- Merge commit: `e7323c4f21c9b71eb4b2ee3f96ae294fd53ca516` +- Title: "New user onboarding" + +## Current State Analysis + +### Commits Since PR #714 (53 total) +The following PRs were merged after #714: +- #746: Site editor sidebar (not onboarding related) +- #744: Fix interactive task resubmission (not onboarding related) +- #743: Safeguards for plugin update (not onboarding related) +- #742: Update for #740 (not onboarding related) +- #741: Onboarding tweaks (**onboarding related**) +- #740: Remove popover positioning (not onboarding related) +- #739: Exclude direct_file_access check (not onboarding related) +- #738: Fix year-week boundary bug (not onboarding related) +- #736: Delay onboarding init (**onboarding related**) +- #733: Reverse filter logic (**onboarding related**) +- #730: New onboarding tweaks (**onboarding related**) + +### PRs with Onboarding Changes (need special handling) + +| PR | Files Changed | Non-Onboarding Changes | +|----|---------------|------------------------| +| #730 | `assets/css/onboarding/onboarding.css`, `assets/js/onboarding/steps/SettingsStep.js`, `views/onboarding/settings.php` | `classes/class-plugin-upgrade-tasks.php` (upgrade task condition) | +| #733 | `classes/class-onboard-wizard.php`, `tests/phpunit/test-class-onboard-wizard.php` | None | +| #736 | `assets/js/onboarding/onboarding.js`, `classes/class-onboard-wizard.php` | `classes/utils/class-debug-tools.php`, `classes/utils/class-playground.php` | +| #741 | Multiple onboarding views and CSS | None | + +### Files Created by PR #714 (New Onboarding) +These files/directories didn't exist before and will need to be **deleted**: +``` +assets/css/onboarding/ +assets/images/onboarding/ +assets/js/onboarding/ +classes/class-onboard-wizard.php +tests/phpunit/test-class-onboard-wizard.php +views/onboarding/ +``` + +### Files Deleted by PR #714 (Old Onboarding) +These files need to be **restored** from before the merge: +``` +assets/css/onboard.css +assets/css/welcome.css +assets/js/onboard.js +views/welcome.php +``` + +### Files Modified by PR #714 (Need Selective Revert) +These existing files were modified and need **careful handling**: +``` +assets/css/admin.css +assets/js/settings.js +classes/admin/class-page-settings.php +classes/admin/class-page.php +classes/class-base.php +classes/class-suggested-tasks.php +classes/suggested-tasks/class-tasks-interface.php +classes/suggested-tasks/providers/class-blog-description.php +classes/suggested-tasks/providers/class-select-locale.php +classes/suggested-tasks/providers/class-select-timezone.php +classes/suggested-tasks/providers/class-site-icon.php +classes/suggested-tasks/providers/class-tasks.php +classes/ui/class-chart.php +classes/utils/class-date.php +tests/e2e/sequential/onboarding.spec.js +views/admin-page.php +``` + +--- + +## Execution Plan + +### Phase 1: Preserve New Onboarding Work + +1. **Create a preservation branch from current develop** + ```bash + git checkout develop + git pull origin develop + git checkout -b filip/new-onboarding-preserved + git push -u origin filip/new-onboarding-preserved + ``` + +2. **Document the branch purpose** + Add a note to the branch or create an issue tracking it. + +--- + +### Phase 2: Create Revert Branch + +1. **Create revert branch** + ```bash + git checkout develop + git checkout -b revert/old-onboarding + ``` + +--- + +### Phase 3: Restore Old Onboarding Files + +1. **Restore deleted files from commit before PR #714** + The parent commit (before merge) is: `e7323c4f21c9b71eb4b2ee3f96ae294fd53ca516^` + + ```bash + # Restore old onboarding files + git checkout e7323c4f21c9b71eb4b2ee3f96ae294fd53ca516^ -- assets/css/onboard.css + git checkout e7323c4f21c9b71eb4b2ee3f96ae294fd53ca516^ -- assets/css/welcome.css + git checkout e7323c4f21c9b71eb4b2ee3f96ae294fd53ca516^ -- assets/js/onboard.js + git checkout e7323c4f21c9b71eb4b2ee3f96ae294fd53ca516^ -- views/welcome.php + ``` + +--- + +### Phase 4: Delete New Onboarding Files + +1. **Remove new onboarding directories and files** + ```bash + rm -rf assets/css/onboarding/ + rm -rf assets/images/onboarding/ + rm -rf assets/js/onboarding/ + rm -f classes/class-onboard-wizard.php + rm -f tests/phpunit/test-class-onboard-wizard.php + rm -rf views/onboarding/ + ``` + +--- + +### Phase 5: Revert Modified Files (Manual Review Required) + +For each file below, compare the old version with the current version and selectively revert onboarding-related changes while keeping other improvements: + +#### 5.1 Core Files (Critical - Review Carefully) + +| File | Action | +|------|--------| +| `classes/class-base.php` | Revert `get_license_generator_content` changes | +| `classes/admin/class-page.php` | Restore `welcome_redirect` method | +| `classes/admin/class-page-settings.php` | Review licensing changes | +| `views/admin-page.php` | Revert onboarding container changes | + +**Commands to view diffs:** +```bash +# View what changed in each file +git diff e7323c4f21c9b71eb4b2ee3f96ae294fd53ca516^..e7323c4f21c9b71eb4b2ee3f96ae294fd53ca516 -- classes/class-base.php +git diff e7323c4f21c9b71eb4b2ee3f96ae294fd53ca516^..e7323c4f21c9b71eb4b2ee3f96ae294fd53ca516 -- classes/admin/class-page.php +git diff e7323c4f21c9b71eb4b2ee3f96ae294fd53ca516^..e7323c4f21c9b71eb4b2ee3f96ae294fd53ca516 -- views/admin-page.php +``` + +#### 5.2 Suggested Tasks Providers +These files had changes for onboarding task providers. Review and revert onboarding-specific code: +- `classes/class-suggested-tasks.php` +- `classes/suggested-tasks/class-tasks-interface.php` +- `classes/suggested-tasks/providers/class-blog-description.php` +- `classes/suggested-tasks/providers/class-select-locale.php` +- `classes/suggested-tasks/providers/class-select-timezone.php` +- `classes/suggested-tasks/providers/class-site-icon.php` +- `classes/suggested-tasks/providers/class-tasks.php` + +#### 5.3 CSS/JS Files +- `assets/css/admin.css` - Revert onboarding-related styles +- `assets/js/settings.js` - Review changes + +#### 5.4 Utility Files +- `classes/ui/class-chart.php` - Review `get_week_badge_gauge_html` method +- `classes/utils/class-date.php` - Review `format_date_for_display` method + +--- + +### Phase 6: Handle Non-Onboarding Changes from Onboarding PRs + +**IMPORTANT:** These changes should be kept even though they came from onboarding-related PRs: + +1. **From PR #730** - `classes/class-plugin-upgrade-tasks.php` + - Changed condition for upgrade tasks display + - **Keep this change** (related to privacy policy acceptance) + +2. **From PR #736** - Playground functionality + - `classes/utils/class-debug-tools.php` - Debug tools for playground + - `classes/utils/class-playground.php` - Playground hooks and license key insertion + - **Keep these changes** (but review if they reference new onboarding) + +--- + +### Phase 7: Update E2E Tests + +1. **Restore old onboarding E2E tests** + ```bash + git checkout e7323c4f21c9b71eb4b2ee3f96ae294fd53ca516^ -- tests/e2e/sequential/onboarding.spec.js + ``` + +2. **Review if tests need updates for any other changes made since** + +--- + +### Phase 8: Final Steps + +1. **Run tests** + ```bash + composer test + npm run test:e2e + ``` + +2. **Run code style checks** + ```bash + composer check-cs + composer phpstan + ``` + +3. **Manual testing checklist** + - [ ] Fresh plugin activation shows old onboarding + - [ ] Welcome page displays correctly + - [ ] Onboarding steps work as expected + - [ ] Dashboard loads without errors + - [ ] Settings page works correctly + - [ ] Playground functionality still works + +4. **Create PR** + ```bash + git add -A + git commit -m "Revert to old onboarding system + + This reverts the new onboarding introduced in PR #714 and subsequent + onboarding-related PRs (#730, #733, #736, #741). + + The new onboarding work is preserved in branch: filip/new-onboarding-preserved" + + git push -u origin revert/old-onboarding + gh pr create --draft --title "Revert to old onboarding system" --body "..." + ``` + +--- + +## Risk Assessment + +### High Risk Areas +1. **`classes/class-base.php`** - Core plugin functionality, changes affect initialization +2. **`views/admin-page.php`** - Main dashboard view +3. **Suggested tasks providers** - May have cross-dependencies + +### Medium Risk Areas +1. **CSS files** - May affect overall admin styling +2. **E2E tests** - May need updates for CI to pass + +### Low Risk Areas +1. **Deleting new onboarding files** - Clean removal +2. **Restoring old files** - Straightforward git checkout + +--- + +## Alternative Approach: Git Revert + +Instead of manual file manipulation, you could try: +```bash +git revert --no-commit e7323c4f21c9b71eb4b2ee3f96ae294fd53ca516 +``` + +However, this may cause conflicts with subsequent commits. The manual approach gives more control. + +--- + +## Rollback Plan + +If the revert causes issues: +1. The new onboarding is preserved in `filip/new-onboarding-preserved` +2. Can simply close the revert PR without merging +3. Current `develop` remains unchanged until PR is merged + +--- + +## Timeline Estimate + +- Phase 1-2: Branch setup - Quick +- Phase 3-4: File restoration/deletion - Quick +- Phase 5: Manual review of modified files - Requires careful review +- Phase 6: Non-onboarding changes - Quick review +- Phase 7-8: Testing and PR - Depends on test results + +--- + +*Plan created: January 21, 2026* +*Last updated: January 21, 2026* From e19f7f7ef5a4537731ab470fbada06e1917a86e3 Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Thu, 22 Jan 2026 14:25:43 +0100 Subject: [PATCH 2/4] test breaking test --- views/admin-page-header.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/admin-page-header.php b/views/admin-page-header.php index 1a6f75343..87b2e141e 100644 --- a/views/admin-page-header.php +++ b/views/admin-page-header.php @@ -18,10 +18,10 @@
-
- + Date: Wed, 4 Feb 2026 10:50:17 +0100 Subject: [PATCH 4/4] Restore onboarding debug toolbar and playground toggle These files were changed on develop as part of the onboarding revert but need to stay intact on this preservation branch. --- classes/utils/class-debug-tools.php | 73 +++++++++++++++++++++++++++++ classes/utils/class-playground.php | 56 +++++----------------- 2 files changed, 86 insertions(+), 43 deletions(-) diff --git a/classes/utils/class-debug-tools.php b/classes/utils/class-debug-tools.php index d6f1d5e30..6b42a5ca6 100644 --- a/classes/utils/class-debug-tools.php +++ b/classes/utils/class-debug-tools.php @@ -48,6 +48,7 @@ public function __construct() { \add_action( 'init', [ $this, 'check_toggle_migrations' ] ); \add_action( 'init', [ $this, 'check_delete_single_task' ] ); \add_action( 'init', [ $this, 'check_toggle_recommendations_ui' ] ); + \add_action( 'init', [ $this, 'check_delete_onboarding_progress' ] ); if ( \defined( '\IS_PLAYGROUND_PREVIEW' ) && \constant( '\IS_PLAYGROUND_PREVIEW' ) === true ) { \add_action( 'init', [ $this, 'check_toggle_placeholder_demo' ] ); } @@ -99,6 +100,8 @@ public function add_toolbar_items( $admin_bar ) { $this->add_toggle_recommendations_ui_submenu_item( $admin_bar ); $this->add_placeholder_demo_submenu_item( $admin_bar ); + + $this->add_onboarding_submenu_item( $admin_bar ); } /** @@ -727,4 +730,74 @@ public function filter_tasks_show_ui( $show_ui ) { } return $show_ui; } + + /** + * Add Onboarding submenu to the debug menu. + * + * @param \WP_Admin_Bar $admin_bar The WordPress admin bar object. + * @return void + */ + protected function add_onboarding_submenu_item( $admin_bar ) { + $admin_bar->add_node( + [ + 'id' => 'prpl-onboarding', + 'parent' => 'prpl-debug', + 'title' => 'Onboarding', + ] + ); + + // Start onboarding. + $admin_bar->add_node( + [ + 'id' => 'prpl-start-onboarding', + 'parent' => 'prpl-onboarding', + 'title' => 'Start Onboarding', + 'href' => '#', + 'meta' => [ + 'onclick' => 'window.prplOnboardWizard.startOnboarding(); return false;', + ], + ] + ); + + // Delete onboarding progress. + $admin_bar->add_node( + [ + 'id' => 'prpl-delete-onboarding-progress', + 'parent' => 'prpl-onboarding', + 'title' => 'Delete Onboarding Progress', + 'href' => \add_query_arg( 'prpl_delete_onboarding_progress', '1', $this->current_url ), + ] + ); + } + + /** + * Check and process the delete onboarding progress action. + * + * Deletes onboarding progress if the appropriate query parameter is set + * and user has required capabilities. + * + * @return void + */ + public function check_delete_onboarding_progress() { + if ( + ! isset( $_GET['prpl_delete_onboarding_progress'] ) || // phpcs:ignore WordPress.Security.NonceVerification.Recommended + $_GET['prpl_delete_onboarding_progress'] !== '1' || // phpcs:ignore WordPress.Security.NonceVerification.Recommended + ! \current_user_can( 'manage_options' ) + ) { + return; + } + + // Verify nonce for security. + $this->verify_nonce(); + + // Delete the onboarding progress. + \Progress_Planner\Onboard_Wizard::delete_progress(); + + // Delete the license key. + \delete_option( 'progress_planner_license_key' ); + + // Redirect to the same page without the parameter. + \wp_safe_redirect( \remove_query_arg( [ 'prpl_delete_onboarding_progress', '_wpnonce' ] ) ); + exit; + } } diff --git a/classes/utils/class-playground.php b/classes/utils/class-playground.php index 988043db8..130a00431 100644 --- a/classes/utils/class-playground.php +++ b/classes/utils/class-playground.php @@ -31,7 +31,6 @@ public function register_hooks() { if ( ! \progress_planner()->get_license_key() && ! \get_option( 'progress_planner_demo_data_generated', false ) ) { $this->generate_data(); \update_option( 'progress_planner_license_key', \str_replace( ' ', '-', $this->create_random_string( 20 ) ) ); - \update_option( 'progress_planner_force_show_onboarding', false ); \update_option( 'progress_planner_todo', [ @@ -48,7 +47,6 @@ public function register_hooks() { \update_option( 'progress_planner_demo_data_generated', true ); } \add_action( 'progress_planner_admin_page_header_before', [ $this, 'show_header_notice' ] ); - \add_action( 'wp_ajax_progress_planner_hide_onboarding', [ $this, 'hide_onboarding' ] ); \add_action( 'wp_ajax_progress_planner_show_onboarding', [ $this, 'show_onboarding' ] ); \progress_planner()->get_settings()->set( 'activation_date', ( new \DateTime() )->modify( '-2 months' )->format( 'Y-m-d' ) ); @@ -80,48 +78,23 @@ public function enable_debug_tools() { } /** - * Toggle the onboarding visibility in the Playground environment. - * - * @param string $action Either 'show' or 'hide'. + * Show the onboarding in the Playground environment. * * @return void */ - private function toggle_onboarding( $action ) { - $nonce_action = "progress_planner_{$action}_onboarding"; - \check_ajax_referer( $nonce_action, 'nonce' ); + public function show_onboarding() { + \check_ajax_referer( 'progress_planner_show_onboarding', 'nonce' ); if ( ! \current_user_can( 'manage_options' ) ) { \wp_die( \esc_html__( 'You do not have sufficient permissions to access this page.', 'progress-planner' ) ); } - if ( $action === 'hide' ) { - \add_option( 'progress_planner_license_key', \str_replace( ' ', '-', $this->create_random_string( 20 ) ) ); - $message = \esc_html__( 'Onboarding hidden successfully', 'progress-planner' ); - } else { - \delete_option( 'progress_planner_license_key' ); - $message = \esc_html__( 'Onboarding shown successfully', 'progress-planner' ); - } - \update_option( 'progress_planner_force_show_onboarding', $action !== 'hide' ); - - \wp_send_json_success( [ 'message' => $message ] ); - } - - /** - * Hide the onboarding in the Playground environment. - * - * @return void - */ - public function hide_onboarding() { - $this->toggle_onboarding( 'hide' ); - } + // Delete onboarding progress to trigger fresh onboarding. + \Progress_Planner\Onboard_Wizard::delete_progress(); + // Delete the license key to trigger onboarding (privacy not accepted). + \delete_option( 'progress_planner_license_key' ); - /** - * Show the onboarding in the Playground environment. - * - * @return void - */ - public function show_onboarding() { - $this->toggle_onboarding( 'show' ); + \wp_send_json_success( [ 'message' => \esc_html__( 'Onboarding shown successfully', 'progress-planner' ) ] ); } /** @@ -135,10 +108,7 @@ public function show_header_notice() { return; } - $show_onboarding = \get_option( 'progress_planner_force_show_onboarding', false ); - $button_text = $show_onboarding ? \__( 'Hide onboarding', 'progress-planner' ) : \__( 'Show onboarding', 'progress-planner' ); - $action = $show_onboarding ? 'hide' : 'show'; - $nonce = \wp_create_nonce( "progress_planner_{$action}_onboarding" ); + $nonce = \wp_create_nonce( 'progress_planner_show_onboarding' ); ?>
@@ -150,16 +120,16 @@ public function show_header_notice() {

-