Make WordPress Core

Opened 3 months ago

Last modified 10 days ago

#59250 new enhancement

New Admin Email subject line should be filterable

Reported by: madtownlems's profile MadtownLems Owned by:
Milestone: 6.5 Priority: normal
Severity: normal Version:
Component: Administration Keywords: good-first-bug has-patch has-unit-tests has-testing-info needs-testing
Focuses: Cc:

Description

When a user attempts to update the Administration Email Address (Settings->Reading), they receive an email with a link they must click to confirm the change.

The body of the email is filterable (new_admin_email_content), but sadly the subject is not.

I'm proposing adding a new filter, such as new_admin_email_subject, that lets users customize this message.

For reference, I was looking to make it clearer that there is still action needed (to confirm the change), because I've seen LOTS of situations on our networks where these email updates are started - but never confirmed - likely due to the subject line sounding way more like a confirmation than something that requires action.

Attachments (4)

patch.diff (891 bytes) - added by alexanderkoledov 3 months ago.
patch.2.diff (891 bytes) - added by alexanderkoledov 3 months ago.
Filter "new_admin_email_subject" added
59520-with-tests.diff (1.8 KB) - added by shooper 8 weeks ago.
Patch including unit tests
59520-with-tests-and-comments.diff (2.0 KB) - added by shooper 7 weeks ago.
Updated the patch to include comments on the filter so that the Code Reference documentation is updated properly.

Download all attachments as: .zip

Change History (13)

#1 @johnbillion
3 months ago

  • Component changed from General to Administration
  • Keywords needs-patch good-first-bug added
  • Version trunk deleted

@alexanderkoledov
3 months ago

Filter "new_admin_email_subject" added

#2 @alexanderkoledov
3 months ago

  • Keywords has-patch added; needs-patch removed

Filter "new_admin_email_subject" added

Version 0, edited 3 months ago by alexanderkoledov (next)

@shooper
8 weeks ago

Patch including unit tests

#3 @shooper
8 weeks ago

  • Keywords has-unit-tests has-testing-info needs-testing added

Testing Instructions

These steps define how to test the feature or enhancement, and indicates the expected behavior or results.

Steps to Test

  1. Add function to functions.php:
<?PHP
function updated_admin_email_subject() {
    return 'Filtered Admin Subject';
}
add_filter('new_admin_email_subject', 'updated_admin_email_subject');
  1. Login to to wp-admin dashboard
  2. Go to the Settings > General page
  3. Change the Administration Email Address
  4. Click on Save Changes

Expected Results

Lists each expected result or behavior, i.e. what should happen when running the test(s):

  • ✅ E-Mail Received with "Filtered Admin Subject" as the subject line

#4 @johnbillion
8 weeks ago

  • Milestone changed from Awaiting Review to 6.5

#5 @Marc_J
7 weeks ago

In a fresh WordPress 6.3.2 installation I applied the following patch.diff and added the code listed in the Testing Instructions. After changing the admin email address I received an email with the subject "Filtered Admin Subject".

In short: Works as expected ;-)

#6 @nikmeyer
7 weeks ago

On a local fresh WP installation (6.3.2) I tested patch.diff. I added the the testing Code in functions.php and after I changed the admin Email, I received the updated email Subject 'Filtered Admin Subject'.

Works like a charm :)

@shooper
7 weeks ago

Updated the patch to include comments on the filter so that the Code Reference documentation is updated properly.

#7 @xlthlx
3 weeks ago

I tested the https://core.trac.wordpress.org/attachment/ticket/59250/59520-with-tests-and-comments.diff on the WordPress Core trunk, and it works perfectly.

Just one note: the .diff patch, in this case, has to be applied to the src folder instead of the main folder (it would be fine if you are using a regular WordPress install).

#8 follow-up: @DaNish Ali
11 days ago

Hi @xlthlx

I can't find the tests in the src folder. I am using this https://github.com/WordPress/wordpress-develop repo, where should I add the code?

#9 in reply to: ↑ 8 @xlthlx
10 days ago

Replying to DaNish Ali:

Hi @danish-ali,
I hope I understood your question correctly: the tests are in the tests folder, not in the src one.

Hi @xlthlx

I can't find the tests in the src folder. I am using this https://github.com/WordPress/wordpress-develop repo, where should I add the code?

Note: See TracTickets for help on using tickets.