-
Notifications
You must be signed in to change notification settings - Fork 198
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
Prevent sending welcome email immediately on enrole in case their access starts in the future #7615
Conversation
It will help the function listening to the hook to make changes depending on the params
Because the previous hook called this function before the access start date was even set
The previous hook got called 'before' the access dates were set. So it was not possible to check the access date and decide if the email should be sent or not. This hook is called after the date is set. So it's possible to send the email conditionally by checking the access start date
Test the previous changes of this PR with WordPress Playground. |
Test the previous changes of this PR with WordPress Playground. |
Test the previous changes of this PR with WordPress Playground. |
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.
Looks good and works well to me!
Just about the Sensei Pro PR, maybe is better to take a look before merging this, just in case you need to tweak something related to that in this PR. 😉
Test the previous changes of this PR with WordPress Playground. |
Test the previous changes of this PR with WordPress Playground. |
Test the previous changes of this PR with WordPress Playground. |
Test the previous changes of this PR with WordPress Playground. |
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.
This one tested well, though I suppose we shouldn't merge until https://github.com/Automattic/sensei-pro/pull/2586 is also approved.
Test the previous changes of this PR with WordPress Playground. |
Test the previous changes of this PR with WordPress Playground. |
Resolves https://github.com/Automattic/sensei-pro/issues/2572
(Partially)
Proposed Changes
We have switched from hook
sensei_user_course_start
tosensei_course_enrolment_status_changed
becausesensei_user_course_start
hook is fired before the access start date is set. So it's not possible at that point to prevent or allow this email based on access.sensei_course_enrolment_status_changed
is fired after everything is in place.We have improved our base email generator class. Now it allows you to listen to multiple hooks. Previously you could only attach to one.
Updated the
sensei_send_emails
to contain the placeholders as well. This will allow us to add listener hook functions that take decisions based on relevant values.Testing Instructions
New/Updated Hooks
sensei_send_emails
- Addedplaceholders
param.Pre-Merge Checklist