Make WordPress Core

Opened 7 weeks ago

Closed 5 weeks ago

Last modified 4 weeks ago

#66173 closed defect (bug) (fixed)

Change admin and user email: admin notices and usability inconsistencies

Reported by: afercia Owned by: afercia
Priority: normal Milestone: 7.2
Component: Users Version:
Severity: normal Keywords: has-screenshots has-patch commit
Cc: Focuses: administration

Description (last modified by afercia)

Both the 'administrative' email and the current user email can be changed from the WP admin.

The two email have different nature and purpose.

  • The administrative email can be changed from the General Settings page. it's saved to the options. The change request is saved in the options table as well as option_name: new_admin_email.
  • The current user email can be changed from the User profiel page. It's saved in the users table user entry. The change request is saved in the usermeta table as meta_key: _new_email.

Note that the current user email may or may not be the same as the administrative email.

Regarldess of whether it's the administrative email or the current user email, this ticket aims to address some usability inconsistencies.

1
When changing the current user email from the User profile page:

  • 3 admin notices are rendered on the page:
  • Info (blue) notice: Your email address has not been updated yet ... etc..
  • Success (green) notice: Profile updated..
  • A third notice is rendered in the middle of the page, after the email field: There is a pending change of your email ... etc..
  • The third notice is the only place that contains a link to 'cancel' the change request. It's buried down on the page and little discoverable.

2
When changing the administrative email from the General Settings page:

  • Only 2 notices are rendered on the page.
  • A success (green) notice: Settings saved.. This is the default notice text for any save settings action.
  • A succes (green) notice in the middle of the page, after the 'Administration Email Address' field: There is a pending change of the admin email ... etc..

I see a few problems with the current user experience:

1
Either both flows should show a blue notice at the top or none. The notice information is important enough because it informs the change is not effective yet. As such, I'd suggest to add the info notice in the General settings page.

2
The notices in the middle of the page are very little discoverable and may be missed. They are the only place where a 'Cancel' action is available. Ideally, the Cancel action should be more prominent, maybe at the top of the page.

3
Both the notices in the middle of the page are green, they are the 'success' type. This is wrong because they don't provide a 'success' feedback. Rather, they inform users that there is a pending change request. As such, they should be either info or warning notices.

Before attempting any patch or PR, I suggest waiting for design feedback.

See also attached screenshots.

Attachments (4)

01 profile.png​ (93.1 KB ) - added by afercia 7 weeks ago.
User profile page: notices at the top of the page.
02 profile.png​ (86.5 KB ) - added by afercia 7 weeks ago.
User profile page: notice in the middle of the page.
03 general administrative email.png​ (348.2 KB ) - added by afercia 7 weeks ago.
General Settings page: only two notices.
01 useer profile and genereal settings.png​ (558.9 KB ) - added by afercia 5 weeks ago.

Download all attachments as: .zip

Change History (25)

@afercia
7 weeks ago

User profile page: notices at the top of the page.

@afercia
7 weeks ago

User profile page: notice in the middle of the page.

This ticket was mentioned in ​PR #13751 on ​WordPress/wordpress-develop by ​@devansh2002.


7 weeks ago
#1

  • Keywords has-patch has-unit-tests added

When a $path is passed to wp_get_global_settings() or wp_get_global_styles() and that path does not exist, both functions return the entire settings/styles array. This happens because the full array is passed as the fallback to _wp_array_get(). Callers cannot tell "not set" apart from "all settings"

This PR:

  • Returns null from both functions when the requested path does not exist. An empty $path still returns everything, as before.
  • Updates block_core_image_get_lightbox_settings() in the Image block. It relied on the old behaviour to fall back to the top-level lightbox setting, and now also falls back when the block-level lookup returns null. It works under both the old and new behaviour. A matching change is needed in Gutenberg (packages/block-library/src/image/index.php), since that file is synced from there.
  • Adds unit tests for existing, missing (top-level and nested), and empty paths, for a missing block, and for the Image lightbox fallback.

Other core callers that pass a path (button.php, block-supports/states.php, block-supports/block-visibility.php, and the wp_get_global_styles( array( 'color' ) ) call in image.php) already handle null.

Trac ticket: https://core.trac.wordpress.org/ticket/66173

Use of AI Tools

AI assistance: Yes
Tool(s): Claude
Model(s): Opus 5.5
Used for: Initial code skeleton and test suggestions; final implementation and tests were reviewed and edited by me.

#2 @afercia
6 weeks ago

  • Keywords has-patch has-unit-tests removed

#3 @afercia
6 weeks ago

Additionally, when clicking the activation links in the confirmation email:

  • User profile page: It does show the 'Profile Updated.' notice at the top of the page.
  • General settings page: It does not show any success notice.

#4 @afercia
6 weeks ago

  • Owner set to afercia
  • Status new → assigned

This ticket was mentioned in ​PR #13927 on ​WordPress/wordpress-develop by ​@afercia.


6 weeks ago
#5

  • Keywords has-patch added

Trac ticket: https://core.trac.wordpress.org/ticket/66173#comment:4

Use of AI Tools

None

#6 @afercia
6 weeks ago

  • Milestone Awaiting Review → 7.2

This ticket was mentioned in ​Slack in #meta by afercia. ​View the logs.


5 weeks ago

#9 @afercia
5 weeks ago

  • Keywords commit added

In the screenshot below: the changes after ​PR 13927. Left: the User profile notices. Right: the General Settings notices.

#10 @afercia
5 weeks ago

  • Resolution → fixed
  • Status assigned → closed

In 64228:

Users: Improve the usability and consistency of the admin notices related to email changes.

  • Renders an admin 'info' notice in the General Settings page when changing the administration email.
  • The notice is similar to the one already rendered in the User Profile when changing the user email.
  • Both the notices at the top are now rendered after the 'settings saved' one.
  • For both notices:
  • The 'Cancel' link text is now a more meaningful 'Cancel request'.
  • The 'Cancel request' link is now rendered also in the admin notice at the top.
  • The notices in the middle of the page are now of type 'info' instead of 'success'. This is consistent with the notices at the top. Also, the notices content is informative and the previous 'success' type was not appropriate.
  • Changes the text of one of the notices by updating the text 'admin email' to 'administration email' for consistency with the related setting label.
  • Improves the redirect links by using add_query_arg().

Developed in ​https://github.com/WordPress/wordpress-develop/pull/13927

Fixes #66173.

#11 @ravipatel
5 weeks ago

Describe the bug: the email-change notice shows twice on Network Admin → Profile and on the User Dashboard profile.
Ask for the ticket to be reopened. Only committers and trusted contributors can reopen it.
If nobody reopens it, open a new ticket instead. Use the Users component and milestone 7.2, and link it to #66173.

This ticket was mentioned in ​PR #14086 on ​WordPress/wordpress-develop by ​@ravipatel.


5 weeks ago
#12

  • Keywords has-unit-tests added

Follow-up to r64228. That change stopped hooking new_user_email_admin_notice() to admin_notices and renders it directly in wp-admin/user-edit.php. But the function stayed hooked to user_admin_notices and network_admin_notices in wp-admin/includes/ms-admin-filters.php. Since r64228 also dropped the ?updated check, the notice now appears twice on the Network Admin and User Dashboard profile screens whenever an email change is pending.

This PR:

  • Removes the two leftover multisite hooks.
  • Adds a @since 7.2.0 changelog entry to new_user_email_admin_notice().
  • Adds unit tests in tests/phpunit/tests/user/newUserEmailAdminNotice.php.
  • Removes trailing commas from two function calls added in r64228 (separate commit).

Testing instructions

  1. On a multisite install, go to Network Admin → Profile and change your email address.
  2. Before this PR, the "Your email address has not been updated yet…" notice appears twice. After it, the notice appears once.
  3. Run npm run test:php -- --filter Tests_User_NewUserEmailAdminNotice and the same command with -c tests/phpunit/multisite.xml.

Trac ticket: https://core.trac.wordpress.org/ticket/66173

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Finding the regression during a review of recent commits, drafting the fix and tests. I reviewed, ran and verified all changes (the tests fail without the fix and pass with it).

#13 @ravipatel
5 weeks ago

  • Keywords has-unit-tests removed

Reopening: since [64228], the email change notice is displayed twice on the Network Admin and User Dashboard profile screens, because new_user_email_admin_notice() is still hooked to user_admin_notices and network_admin_notices in ms-admin-filters.php.

PR: ​https://github.com/WordPress/wordpress-develop/pull/14086

#14 @afercia
5 weeks ago

  • Resolution fixed
  • Status closed → reopened

#15 @afercia
5 weeks ago

@ravipatel good catch, thanks for the PR. Will commit soon.

As per the trailing commas, to my understanding they are recommended by [​https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#indentation the current PHP standards}:

Note the comma after the last array item: this is recommended because it makes it easier to change the order of the array, and makes for cleaner diffs when new items are added.

​@afercia commented on ​PR #14086:


5 weeks ago
#16

@rvpatel thanks for your PR.
By any chance, did you fork your repository from another fork? Ideally, it should be forked from the official wordpress-develop repo instead.
If no objections, you should grant write access to your fork as it appears I can't push changes there.

​@ravipatel commented on ​PR #14086:


5 weeks ago
#17

Thanks @afercia! You're right: my fork was created from another fork (ravikumarup/wordpress-develop) instead of WordPress/wordpress-develop. I've invited you as a collaborator on rvpatel/wordpress-develop, so you should be able to push once you accept the invitation. I'll re-fork from the official repository once my open PRs are wrapped up.

​@afercia commented on ​PR #14086:


5 weeks ago
#18

Thanks @rvpatel yes it's more about having a better setup for the future, not urgent :)

​@afercia commented on ​PR #14086:


5 weeks ago
#19

Just a note to help quickly reproduce the issue: the duplicate notice can be observed on pages like:
​http://localhost:8889/wp-admin/network/profile.php
​http://localhost:8889/wp-admin/user/profile.php
​http://localhost:8889/wp-admin/user/

#20 @afercia
5 weeks ago

  • Resolution → fixed
  • Status reopened → closed

In 64239:

Users: Prevent duplicate email change admin notices on multisite.

Follow-up to [64228].

  • Remove duplicate admin notices hooked from ms-admin-filters.php.
  • Update @since tag for the new_user_email_admin_notice() docblock.
  • Add unit tests for new_user_email_admin_notice().

Developed in ​https://github.com/WordPress/wordpress-develop/pull/14086

Props ravipatel.
Fixes #66173.

#21 @afercia
4 weeks ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.