From 523a49da9b6e735e2dbd232ffc86fb921b36b23c Mon Sep 17 00:00:00 2001 From: Filip Ilic Date: Wed, 17 Dec 2025 14:56:10 +0100 Subject: [PATCH 1/3] remove "default login destination" --- assets/js/onboarding/steps/SettingsStep.js | 91 +--------------------- views/onboarding/settings.php | 69 +--------------- 2 files changed, 4 insertions(+), 156 deletions(-) diff --git a/assets/js/onboarding/steps/SettingsStep.js b/assets/js/onboarding/steps/SettingsStep.js index e16b64f38..8986db6e7 100644 --- a/assets/js/onboarding/steps/SettingsStep.js +++ b/assets/js/onboarding/steps/SettingsStep.js @@ -1,18 +1,11 @@ /** - * Settings step - Configure About, Contact, FAQ pages, Post Types, and Login Destination + * Settings step - Configure About, Contact, FAQ pages, and Post Types * Multi-step process with 5 sub-steps */ /* global OnboardingStep, ProgressPlannerOnboardData */ class PrplSettingsStep extends OnboardingStep { - subSteps = [ - 'homepage', - 'about', - 'contact', - 'faq', - 'post-types', - 'login-destination', - ]; + subSteps = [ 'homepage', 'about', 'contact', 'faq', 'post-types' ]; defaultSettings = { homepage: { @@ -34,9 +27,6 @@ class PrplSettingsStep extends OnboardingStep { 'post-types': { selectedTypes: [], // Array of selected post type slugs }, - 'login-destination': { - redirectOnLogin: false, // Checkbox state - }, }; constructor() { @@ -137,7 +127,7 @@ class PrplSettingsStep extends OnboardingStep { /** * Setup event listeners for a sub-step - * @param {string} subStepName - Name of sub-step (about/contact/faq/post-types/login-destination) + * @param {string} subStepName - Name of sub-step (about/contact/faq/post-types) * @param {Object} subStepData - Data for this sub-step * @param {Object} state - Wizard state */ @@ -153,16 +143,6 @@ class PrplSettingsStep extends OnboardingStep { // Handle post types sub-step if ( subStepName === 'post-types' ) { this.setupPostTypesListeners( subStepName, subStepData, state ); - return; - } - - // Handle login destination sub-step - if ( subStepName === 'login-destination' ) { - this.setupLoginDestinationListeners( - subStepName, - subStepData, - state - ); } } @@ -342,60 +322,6 @@ class PrplSettingsStep extends OnboardingStep { this.updateSaveButtonState( saveButton, subStepData ); } - /** - * Setup event listeners for login destination sub-step - * @param {string} subStepName - Name of sub-step - * @param {Object} subStepData - Data for this sub-step - * @param {Object} state - Wizard state - */ - setupLoginDestinationListeners( subStepName, subStepData, state ) { - const container = this.popover.querySelector( - `.prpl-setting-item[data-page="${ subStepName }"]` - ); - const saveButton = this.popover.querySelector( - `#prpl-save-${ subStepName }-setting` - ); - - if ( ! container || ! saveButton ) { - return; - } - - // Get checkbox - const checkbox = container.querySelector( - 'input[type="checkbox"][name="prpl-redirect-on-login"]' - ); - - if ( ! checkbox ) { - return; - } - - // Initialize from checkbox that is already set in template, or from saved data - if ( subStepData.redirectOnLogin === undefined ) { - subStepData.redirectOnLogin = checkbox.checked; - } else { - checkbox.checked = subStepData.redirectOnLogin; - } - - // Add change listener - checkbox.addEventListener( 'change', ( e ) => { - subStepData.redirectOnLogin = e.target.checked; - this.updateSaveButtonState( saveButton, subStepData ); - - // Update Next/Dashboard button if on last sub-step - if ( this.currentSubStep === this.subSteps.length - 1 ) { - this.updateNextButton(); - } - } ); - - // Save button handler - just advances to next sub-step - saveButton.addEventListener( 'click', () => { - this.advanceSubStep( state ); - } ); - - // Initial button state - this.updateSaveButtonState( saveButton, subStepData ); - } - /** * Advance to next sub-step * @param {Object} state - Wizard state @@ -445,11 +371,6 @@ class PrplSettingsStep extends OnboardingStep { return subStepData.selectedTypes.length > 0; } - // Handle login destination sub-step - always valid (checkbox is optional) - if ( subStepData.redirectOnLogin !== undefined ) { - return true; - } - return false; } @@ -525,12 +446,6 @@ class PrplSettingsStep extends OnboardingStep { } ); } - // Add login destination - const loginData = state.data.settings[ 'login-destination' ]; - if ( loginData && loginData.redirectOnLogin ) { - formDataObj.append( 'prpl-redirect-on-login', '1' ); - } - // Send single AJAX request const response = await fetch( ProgressPlannerOnboardData.adminAjaxUrl, diff --git a/views/onboarding/settings.php b/views/onboarding/settings.php index f928ca3c6..fa407bd9f 100644 --- a/views/onboarding/settings.php +++ b/views/onboarding/settings.php @@ -42,10 +42,7 @@ $prpl_saved_settings = \progress_planner()->get_settings()->get_post_types_names(); $prpl_post_types = \progress_planner()->get_settings()->get_public_post_types(); -// Get redirect on login setting. -$prpl_redirect_on_login = \get_user_meta( \get_current_user_id(), 'prpl_redirect_on_login', true ); - -$prpl_total_number_of_steps = 6; +$prpl_total_number_of_steps = 5; $prpl_current_step_number = 0; ?> @@ -200,70 +197,6 @@ class="prpl-btn prpl-save-setting-btn" - - - -
-
-
-
-

-
-
-
-
-

- - / -

-

- get_ui__branding()->get_admin_menu_name() ) ); - ?> -

-
- -
-
-

- -

- - the_view( - 'onboarding/form-inputs/checkbox.php', - [ - 'name' => 'redirect_on_login', - 'current_value' => '', - 'options' => [ - [ - 'id' => 'prpl-setting-redirect-on-login', - 'label' => \sprintf( - /* translators: %s: Progress Planner name. */ - \esc_html__( 'Show the %s dashboard after login.', 'progress-planner' ), - \esc_html( \progress_planner()->get_ui__branding()->get_admin_menu_name() ) - ), - 'value' => '1', - ], - ], - ] - ); - ?> -
-
- -
-
-