-
Notifications
You must be signed in to change notification settings - Fork 195
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
Fix wp_mail still working for temporary users #6868
Conversation
Codecov Report
@@ Coverage Diff @@
## trunk #6868 +/- ##
=========================================
Coverage 46.87% 46.87%
Complexity 10189 10189
=========================================
Files 554 554
Lines 36748 36748
Branches 381 381
=========================================
+ Hits 17226 17227 +1
+ Misses 19216 19215 -1
Partials 306 306
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
add_filter( 'pre_wp_mail', [ Sensei_Guest_User::class, 'skip_wp_mail' ], 10, 2 ); | ||
add_filter( 'pre_wp_mail', [ Sensei_Preview_User::class, 'skip_wp_mail' ], 10, 2 ); |
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.
I'm not a huge fan of this change: basically, I'm adding the filters here for each class.
I thought about maybe creating a method in each class just to run that add_filter
and call it here, but I think the result would be...quite similar, so that's why I left it this way.
This is also the main change that fixes the issue, so..yeah, there's that.
…nd Sensei_Preview_User
… in the Sensei_Temporary_User class
1fb0a18
to
09fd44e
Compare
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 as described!
Fix a situation that #6855 didn't cover: Blocking
wp_mail
when the e-mail isn't dispatched from the frontend of the site.Proposed Changes
wp_mail
calls related to temporary users even on non-frontend context;Testing Instructions
The test for this is pretty simple, on WP-CLI, run the following commands, line by line:
Here's the code running on this branch:
This is the code running on the
trunk
branch:Pre-Merge Checklist