Opened 9 years ago
Last modified 6 years ago
#33932 reviewing enhancement
Filters for Plugin/Theme Update Email Notifications
Reported by: | ronalfy | Owned by: | ocean90 |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.7 |
Component: | Upgrade/Install | Keywords: | has-patch needs-refresh needs-unit-tests |
Focuses: | Cc: |
Description
I've had several requests to enable core update emails, but disable emails for plugins/themes.
If this idea is approved, I would love to be the one to tackle this as I have yet to contribute to core.
Goal is to keep send_core_update_notification_email
intact, but allow filters for both plugin/theme background update notifications.
Apparent use-case is a user wants core emails, but not plugin/theme emails. One filter rules them all currently from what I can see in the code-base.
Example use-case in the wild: https://wordpress.org/support/topic/for-on-the-wishlist?replies=8
Attachments (11)
Change History (51)
#1
@
9 years ago
Patch 2 simplifies the filter calls and moves everything to one filter since we're already passing the type.
This ticket was mentioned in Slack in #core by ronaldhuereca. View the logs.
9 years ago
#4
@
9 years ago
Patch 3 solves the issue since we're already passing type for context. No reason to have 3 conditionals.
#5
@
9 years ago
- Component changed from General to Upgrade/Install
- Focuses docs removed
- Keywords reporter-feedback added
- Milestone changed from Awaiting Review to Future Release
- Version changed from 4.3 to 3.7
Thanks for the patch, Ronald!
This filter makes sense. Here's some feedback on your patch:
- If the filter returns false for one or more of the update types, it prevents the email from being sent for all subsequent update types too. The
return
statement after the filter should probably be acontinue
. Then below theforeach
loop you couldreturn
if the$body
variable is empty. - The diff should be generated from the root of your repo so other people can apply the patch without having to specify which file is to be patched.
- There's a typo in the docblock:
translators
instead oftranslations
. - Passing
$this
as the third parameter to the filter would be a good idea so the filter receives as much context as possible.
#6
@
9 years ago
Thank you! I'll revisit this tomorow and revise my patch. Thank you SO much for the feedback.
Kinda curious why 4.3 was moved back to 3.7. Please pardon my noob-ness.
#7
@
9 years ago
@johnbillion,
Added the requested changes and worked with my internal testing.
Anything I missed? Ping me on slack (ronaldhuereca). May need some mentoring here if patch is submitted incorrectly.
#9
@
9 years ago
- Owner set to johnbillion
- Resolution set to fixed
- Status changed from new to closed
In 34543:
#11
@
9 years ago
Just an FYI. I was instructed to create a new ticket.
There is a bug for the committed patch when I tested against WordPress 4.4 Beta 1. Here is the new ticket.
#12
follow-up:
↓ 13
@
9 years ago
- Keywords needs-patch revert added; has-patch dev-feedback 2nd-opinion needs-testing removed
#13
in reply to:
↑ 12
@
9 years ago
Replying to ocean90:
[34543] is incomplete because there is a second loop for the "UPDATE LOG" part. This and the bug mentioned in #34434 sounds like we should revert [34543] for 4.4 and give it another try in 4.5.
Agreed on the revert unless patch for #34434 can be committed. Will post a new patch when 4.5 is in the pipeline.
This ticket was mentioned in Slack in #core by ocean90. View the logs.
9 years ago
#18
follow-up:
↓ 19
@
9 years ago
- Milestone changed from Future Release to 4.5
@ronalfy Do you want to tackle this again?
#19
in reply to:
↑ 18
@
9 years ago
Replying to johnbillion:
@ronalfy Do you want to tackle this again?
Sure! I can do that. I'll try again this weekend.
#20
@
9 years ago
@johnbillion Added Patch 5. I've tested this with background updates for themes, plugins, core, and various combinations of each to ensure the patch is correct.
Can you please look over and offer any suggestions?
Thanks!
PS: I may have to redo this since there seems to be a bug (see #34878) with automatic updates at the moment.
This ticket was mentioned in Slack in #core by jorbin. View the logs.
9 years ago
#22
@
9 years ago
- Milestone changed from 4.5 to Future Release
There hasn't been any recent activity on this ticket and the beta 1 deadline for 4.5 is tomorrow, so punting.
#23
@
9 years ago
I have tested patch.6.diff and all works great. Each filter did what it was suppose to do.
#24
@
9 years ago
- Keywords has-patch added; needs-patch removed
@ocean90 @adamsilverstein would you be willing to consider this patch for WordPress 4.6?
A common use case is if a user has automatic updates for plugins/themes/translations. We have a fairly popular plugin (60k) installs where users are constantly complaining of the massive influx of notification e-mails with the only option to turn them off using a all-is-on, all-is-off filter.
I've thoroughly tested this with plugin updates, translation updates, theme updates, and core minor/update updates.
#25
@
9 years ago
Added patch based on recs from @adamsilverstein to modify class var directly instead of creating new var.
Tested the same as above.
This ticket was mentioned in Slack in #core by ronaldhuereca. View the logs.
9 years ago
#28
@
9 years ago
I added a rather large patch that contains unit test. The reason for the size is that there seemed to be no tests related to the send_debug_email
method or the upgrader component ( at least that I could find ) so I needed to add them.
The tests added here have a baseline test for the method and some tests for the filter. There is also a fix in place here that addresses #36609 which was discovered while writing the tests for this patch.
Any feedback or direction is welcome.
#31
@
9 years ago
@welcher found a bug in the patch. I think we need a similar path to where I essentially clone the class var instead of modifying it directly. https://core.trac.wordpress.org/attachment/ticket/33932/patch.6.diff
Modifying it directly can cause the action automatic_updates_complete
to not pass the proper data.
#32
@
9 years ago
Added patch to fix bug in @welcher's patch when patch7 was added.
We need to basically clone the class var because the action automatic_updates_complete
needs the full dataset.
Modifying the class variable will make this hook unreliable, so I chose to create a method variable instead to eliminate this conflict.
#33
@
9 years ago
- Keywords needs-refresh added
Some feedback about 33932.patch:
- The doc block for
send_update_notification_email
needs to be aligned with a whitespace before the*
. - The documentation should start with "Filter whether to".
- It seems like the current documentation was copied from the
send_core_update_notification_email
filter. The new filter should have its own documentation because the current one is wrong. - It's also worth to mention, that the suggested filter lives in
send_debug_email
, naming itsend_update_notification_email
feels wrong. - Changes to tests/phpunit/tests/mail.php should be part of a separate ticket. It seems like [37307] fixed parts of this already.
- In
test_send_update_notification_email_filter_no_emails()
the comment forsend_update_notification_email
should be just// Disable all notifications.
- In
test_send_update_notification_email_filter_remove_single_type()
the comment forsend_update_notification_email
is wrong (copy/paste error). - In
test_send_update_notification_email_filter_remove_single_type()
the variable variable$$type
looks odd. The alignment should be improved too.
#34
@
9 years ago
- Keywords needs-unit-tests added; has-unit-tests removed
Thanks for the feedback @ocean90. I changed the filter name to have better context. It's now send_debug_notification_email
.
Based on the feedback on the unit tests, I removed them and just included the filter in this patch.
@welcher would you be up to opening a separate ticket and applying your unit tests based on the above feedback?
THANKS!
This ticket was mentioned in Slack in #core by ronaldhuereca. View the logs.
9 years ago
This ticket was mentioned in Slack in #core by ronaldhuereca. View the logs.
9 years ago
#37
@
9 years ago
- Owner changed from johnbillion to ocean90
- Status changed from reopened to reviewing
#38
@
9 years ago
@ocean90 applied new patch. If committed, recommend @kidsguide for props as he helped with testing.
Patch to add theme, plugin, translation files.