Skip to content

Conversation

@bogiii
Copy link
Contributor

@bogiii bogiii commented Mar 31, 2025

Resolves #7774

Proposed Changes

  • Update the activation logic to always enable the setup wizard on the first installation

Testing Instructions

  1. Checkout this branch locally
  2. Run npm run build
  3. Open a /wp-admin/plugins.php page of your WPCOM business site
  4. Upload a plugin sensei-lms.zip file from the root of this repo (the file is created in step 2)
  5. Activate it and check if there is Sensei onboarding

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • Code is tested on the minimum supported PHP and WordPress versions

@bogiii bogiii self-assigned this Mar 31, 2025
@bogiii bogiii requested review from a team and renatho March 31, 2025 21:18
@bogiii bogiii added this to the 4.24.6 milestone Mar 31, 2025
@github-actions
Copy link

Test the previous changes of this PR with WordPress Playground.

@github-actions
Copy link

Test the previous changes of this PR with WordPress Playground.

@bogiii bogiii marked this pull request as ready for review March 31, 2025 21:25
@bogiii bogiii requested review from m1r0 and removed request for renatho April 4, 2025 13:49
update_option( Sensei_Setup_Wizard::SUGGEST_SETUP_WIZARD_OPTION, 1 );
}

update_option( 'sensei_installed', 1 );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By looking at the previous logic, I think this update option only triggers when if ( false === get_option( 'sensei_installed', false ) ) is true. Do you think it make sense to move inside the if statement so it wont trigger on each plugin activation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the contrary, that's precisely how it works, only on the first installation and not on each activation.

Copy link
Member

@m1r0 m1r0 Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I probably didn't explain it well. Here's a quick clip of what I mean:

1nCOhW.mp4

With the current logic, the update_option( 'sensei_installed', 1 ) is always called when the plugin is activated. By moving that code inside the if statement, this database call should be avoided. By looking at the previous logic, this is how it worked before, but it used a somewhat confusing return call to prevent the update_options call. Does it make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouch, you were precise enough. I misunderstood it.
It makes sense; I'll move it to be part of the if block.

@bogiii bogiii requested a review from m1r0 April 8, 2025 11:00
@bogiii bogiii force-pushed the update/sensei-activation-hook branch from 65373a0 to 7410a2e Compare April 8, 2025 12:42
@github-actions
Copy link

github-actions bot commented Apr 8, 2025

Test the previous changes of this PR with WordPress Playground.

Copy link
Member

@m1r0 m1r0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests well! 🚀

@bogiii bogiii merged commit 21a7e92 into trunk Apr 8, 2025
22 checks passed
@bogiii bogiii deleted the update/sensei-activation-hook branch April 8, 2025 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When installing Sensei LMS on WPCOM it doesn't start the Setup Wizard automatically like a self-hosted site

3 participants