Make WordPress Core

Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#38068 closed enhancement (fixed)

Add filters to wp_new_user_notification and wp_password_change_notification

Reported by: pbearne's profile pbearne Owned by: johnbillion's profile johnbillion
Milestone: 4.9 Priority: normal
Severity: normal Version:
Component: Users Keywords:
Focuses: Cc:

Description

There is a filters (retrieve_password_title and retrieve_password_message) to set retrieve password message in wp-login but not for wp_new_user_notification and wp_password_change_notification in pluggable.php this patch adds them

the new filters are
wp_password_change_notification_subject
wp_password_change_notification_message
wp_password_change_notification_headers

wp_new_user_notification_admin_message
wp_new_user_notification_admin_subject
wp_new_user_notification_admin_headers

wp_new_user_notification_message
wp_new_user_notification_subject
wp_new_user_notification_headers

Attachments (8)

pluggable.php.patch (6.3 KB) - added by pbearne 8 years ago.
patch
pluggable.php.2.patch (6.7 KB) - added by pbearne 8 years ago.
added comment that these filter might be missing due to function pluggable
pluggable.php.3.patch (6.7 KB) - added by pbearne 8 years ago.
fixed wp_mail call that was missing $mesage_header parm
38068.diff (6.6 KB) - added by dipesh.kakadiya 8 years ago.
User date added as message filter argument for updated password
38068.2.diff (6.6 KB) - added by dipesh.kakadiya 8 years ago.
Filter argument updated
38068.3.diff (5.6 KB) - added by johnbillion 7 years ago.
38068.patch (9.2 KB) - added by pbearne 7 years ago.
patch using array format
38068.2.patch (8.9 KB) - added by johnbillion 7 years ago.

Download all attachments as: .zip

Change History (28)

@pbearne
8 years ago

patch

#1 @pbearne
8 years ago

  • Keywords has-patch dev-feedback needs-codex added

#2 @kraftbj
8 years ago

Howdy! Thanks for the patch. It's easier for folks to apply/test patches if they are created from the svn root, so the full path (e.g. src/wp-includes/pluggable.php etc) is part of the patch.

I like this—makes it easier to customize these without having to totally duplicate the functions.

That said, being in pluggable.php, these functions can be wholly overwritten by plugins, making the filters unavailable. I don't see this done in other filters in pluggable.php, but would it makes sense to denote that in the inline documentation?

#3 @pbearne
8 years ago

For an example look at wp_notify_moderator() I copied the headers filter to match

I have been working on WP VIP project so can only ship a theme where the client wanted to change the eamil content but I can't replace the pluggable function in a theme as the file sis load before the theme

Yes there will be plugin/code that overloads the function that will not have the filters but any new one and updates can have them. The filter not not been there is not a reason to not add them

will fix patch root I thought is was the dev root

@pbearne
8 years ago

added comment that these filter might be missing due to function pluggable

This ticket was mentioned in Slack in #core by pbearne. View the logs.


8 years ago

#5 @johnbillion
8 years ago

@pbearne Could you check the $message_headers functionality in your patch please? Looks like at least one occurrence isn't used in wp_mail().

@pbearne
8 years ago

fixed wp_mail call that was missing $mesage_header parm

#6 @pbearne
8 years ago

Thanks for the spot @johnbillion found and fixed

#7 @pbearne
8 years ago

@johnbillion are you able to get this into 4.7?

This ticket was mentioned in Slack in #core by pbearne. View the logs.


8 years ago

@dipesh.kakadiya
8 years ago

User date added as message filter argument for updated password

@dipesh.kakadiya
8 years ago

Filter argument updated

#9 @jtsternberg
8 years ago

Just ran into this. Seems super odd that these filters aren't already in core. Is there anything we can do to get these in 4.7?

#10 @pbearne
8 years ago

@jtsternberg ping them on slack in the core channel now would a good time as they doing a meeting where this is decided :-)

#11 @johnbillion
7 years ago

  • Keywords dev-feedback removed
  • Milestone changed from Awaiting Review to 4.9
  • Owner set to johnbillion
  • Status changed from new to reviewing

@johnbillion
7 years ago

#12 @johnbillion
7 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 41153:

Users: Introduce filters for the contents of email notifications for new user registrations and password resets.

Introduces:

  • wp_password_change_notification_subject
  • wp_password_change_notification_message
  • wp_password_change_notification_headers
  • wp_new_user_notification_admin_subject
  • wp_new_user_notification_admin_message
  • wp_new_user_notification_admin_headers
  • wp_new_user_notification_subject
  • wp_new_user_notification_message
  • wp_new_user_notification_headers

Props pbearne, dipesh.kakadiya

Fixes #38068

#13 @johnbillion
7 years ago

  • Keywords needs-patch added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

It looks like all of the most recently introduced email notifications use one filter on an array of fields for the email (eg. email_change_email and password_change_email) instead of separate filters for the subject, content, and headers. This pattern should be followed here.

#14 @pbearne
7 years ago

Hi @johnbillion

I will recreate the patch ASP

Paul

@pbearne
7 years ago

patch using array format

#15 @pbearne
7 years ago

Here you go one patch using an array to pass the values

I noted that the wp_mail for the wp_new_user_notification_email_admin has an @errror prexit I wonder if we can remove it?

paul

#16 @johnbillion
7 years ago

  • Keywords has-patch needs-testing added; needs-patch removed
  • Status changed from reopened to reviewing

@johnbillion
7 years ago

#17 @johnbillion
7 years ago

  • Keywords needs-dev-note commit added; needs-codex needs-testing removed

38068.2.patch corrects some errors in 38068.patch and makes some further tweaks. This is good to go.

#18 @johnbillion
7 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 41213:

Users: Switch to using array style filters for the newly introduced filters in wp_password_change_notification() and wp_new_user_notification().

This introduces three new filters, replacing those that were introduced in [41153]:

  • wp_password_change_notification_email
  • wp_new_user_notification_email_admin
  • wp_new_user_notification_email

Props pbearne

Fixes #38068

#19 @johnbillion
7 years ago

  • Keywords has-patch commit removed

#20 @johnbillion
7 years ago

  • Keywords needs-dev-note removed
Note: See TracTickets for help on using tickets.