Repository navigation
Networks and Sites: Address review feedback and add tests for network admin email change notices - #14466
Networks and Sites: Address review feedback and add tests for network admin email change notices#14466robelsust wants to merge 4 commits into
Conversation
…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.
|
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: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
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:
When an invalid or expired confirmation link is clicked, the flow redirects to
settings.php?updated=false. Because the check previously evaluatedisset( $_GET['updated'] ), WordPress falsely rendered the green "Settings saved." notice even though no setting was changed. The check now requiresisset( $_GET['updated'] ) && 'true' === $_GET['updated'].Clicking "Cancel request" no longer redirects with
?updated=true. It redirects cleanly tosettings.phpwithout triggering the "Settings saved." notice.Reused
_x( 'Cancel request', 'admin email change' )to align withwp-admin/options-general.phpand avoid adding a duplicate translatable string for polyglots.Fixed the translator comment indentation to match the
sprintf()parameter indent level.Created
tests/phpunit/tests/multisite/networkAdminEmailChange.phpcovering email change initiation, valid/invalid hash confirmation, option cleanup, notice display conditions, and removable query args.Testing Instructions
/wp-admin/network/settings.php)./wp-admin/network/settings.php?network_admin_hash=invalidhash:settings.php?updated=false.