Skip to content

Networks and Sites: Address review feedback and add tests for network admin email change notices - #14466

Open
robelsust wants to merge 4 commits into
WordPress:trunkfrom
robelsust:fix/66300-network-admin-email-usability
Open

robelsust wants to merge 4 commits into
WordPress:trunkfrom
robelsust:fix/66300-network-admin-email-usability

Conversation

@robelsust

@robelsust robelsust commented Oct 18, 2026 •

Copy link
Copy Markdown

Trac ticket: https://core.trac.wordpress.org/ticket/66300
Follow-up to: #14247

Description

This PR addresses review feedback from @JJJ and @lloc on #14247 and introduces a dedicated unit test suite:

  1. Fix false-positive "Settings saved." notice on failed confirmation:
    When an invalid or expired confirmation link is clicked, the flow redirects to settings.php?updated=false. Because the check previously evaluated isset( $_GET['updated'] ), WordPress falsely rendered the green "Settings saved." notice even though no setting was changed. The check now requires isset( $_GET['updated'] ) && 'true' === $_GET['updated'].
  2. Fix "Cancel request" notice behavior:
    Clicking "Cancel request" no longer redirects with ?updated=true. It redirects cleanly to settings.php without triggering the "Settings saved." notice.
  3. Reuse existing translation context:
    Reused _x( 'Cancel request', 'admin email change' ) to align with wp-admin/options-general.php and avoid adding a duplicate translatable string for polyglots.
  4. Translator comment formatting:
    Fixed the translator comment indentation to match the sprintf() parameter indent level.
  5. Add dedicated PHPUnit tests:
    Created tests/phpunit/tests/multisite/networkAdminEmailChange.php covering email change initiation, valid/invalid hash confirmation, option cleanup, notice display conditions, and removable query args.

Testing Instructions

  1. In a Multisite install, go to Network Admin -> Settings -> Network Settings (/wp-admin/network/settings.php).
  2. Change the Network Admin Email to a new address and save settings.
  3. Verify the pending info notice appears with the new email and a "Cancel request" link.
  4. Visit /wp-admin/network/settings.php?network_admin_hash=invalidhash:
    • Verify it redirects to settings.php?updated=false.
    • Verify "Settings saved." is NOT displayed.
  5. Click "Cancel request":
    • Verify the pending notice is dismissed and "Settings saved." is NOT displayed.
  6. Run PHPUnit and PHPCS:
    vendor/bin/phpunit -c tests/phpunit/multisite.xml tests/phpunit/tests/multisite/networkAdminEmailChange.php
    vendor/bin/phpcs src/wp-admin/network/settings.php tests/phpunit/tests/multisite/networkAdminEmailChange.php

afercia and others added 2 commits October 13, 2026 16:09
…twork admin email change.

- Require 'updated=true' before displaying 'Settings saved' notice to prevent false positives when hash confirmation fails.
- Redirect 'Cancel request' directly to settings.php without 'updated=true'.
- Reuse existing 'admin email change' string context for 'Cancel request'.
- Fix translator comment indentation in network settings.
- Add dedicated unit tests in Tests_Multisite_NetworkAdminEmailChange.

See #66300, WordPress#14247.
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props afercia, therssoftware.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants