Make WordPress Core

Opened 7 years ago

Closed 5 years ago

Last modified 5 years ago

#43029 closed defect (bug) (invalid)

Filter "send_email_change_email" is never called

Reported by: flymike's profile flymike Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.1
Component: Users Keywords:
Focuses: Cc:

Description

The purpose of the "send_email_change_email" filter is to allow the optional suppression of the warning email sent when a user changes their email address.

However, that warning email is sent by function send_confirmation_on_profile_email() at user.php line 2623 - which gets called before the apply_filters for send_email_change_email is called by function wp_user_update() in user.php at line 1856.
So, by the time that (any) send_email_change_email filter could be called, the warning email has already been sent.

Further, function send_confirmation_on_profile_email() resets $_POSTemail? to the original email address, so function wp_user_update() is not even aware that the email address has been changed, and never calls the apply_filters for "send_email_change_email".

Change History (2)

#1 @johnbillion
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Thanks for the report @flymike and I'm sorry that you haven't received a response until now.

I'm unable to reproduce this issue. By adding the following line to a plugin, the Email Changed email is successfully suppressed. You might want to check that the code you're using to suppress the message is actually being executed.

add_filter( 'send_email_change_email', '__return_false' );

#2 in reply to: ↑ description @SergeyBiryukov
5 years ago

Replying to flymike:

The purpose of the "send_email_change_email" filter is to allow the optional suppression of the warning email sent when a user changes their email address.

However, that warning email is sent by function send_confirmation_on_profile_email() at user.php line 2623 - which gets called before the apply_filters for send_email_change_email is called by function wp_user_update() in user.php at line 1856.
So, by the time that (any) send_email_change_email filter could be called, the warning email has already been sent.

To clarify a bit, send_confirmation_on_profile_email() sends the Email Change Request email.

The send_email_change_email filter controls the Email Changed email sent later, after the request is confirmed.

Note: See TracTickets for help on using tickets.