-
Notifications
You must be signed in to change notification settings - Fork 209
Sensei activation: Update the activation logic to always enable the setup wizard on the first installation #7800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Test the previous changes of this PR with WordPress Playground. |
|
Test the previous changes of this PR with WordPress Playground. |
includes/class-sensei.php
Outdated
| update_option( Sensei_Setup_Wizard::SUGGEST_SETUP_WIZARD_OPTION, 1 ); | ||
| } | ||
|
|
||
| update_option( 'sensei_installed', 1 ); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
65373a0 to
7410a2e
Compare
|
Test the previous changes of this PR with WordPress Playground. |
m1r0
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests well! 🚀
Resolves #7774
Proposed Changes
Testing Instructions
npm run build/wp-admin/plugins.phppage of your WPCOM business sitesensei-lms.zipfile from the root of this repo (the file is created in step 2)Pre-Merge Checklist