Repository navigation
Users: Prevent username and email collisions without blocking existing users. - #4749
adamsilverstein wants to merge 10 commits into
Conversation
The check reverted in r55584 ran on every save, so updating a user whose username matches their own email, or who already collided with another user, failed. Usernames can only be set on insert, and emails are now compared against existing usernames only when they are new or changing, excluding the user being saved. Existing collisions are left alone, so no previously valid update starts failing. The same email-vs-username check is mirrored in register_new_user(), edit_user(), the REST users update endpoint and the profile email change confirmation, so users see a form error instead of a generic failure. Imports skip the checks, matching the existing email uniqueness check. Claude-Session: https://claude.ai/code/session_01XXGeBhJbUuzyPyZhFKKM5T
Data providers spell out which saves must be blocked and which must keep working, including the cases behind the r55584 revert: a user whose username is their own email, and users whose existing data already collides with another account. Collisions are seeded directly in the database to mirror sites that predate the check. Replaces the earlier single test, which covered only one update case. Claude-Session: https://claude.ai/code/session_01XXGeBhJbUuzyPyZhFKKM5T
|
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. |
Fixes the PHP coding standards check, which flags misaligned double arrows. Claude-Session: https://claude.ai/code/session_01RmMwj4CN9cF8b1Sx58Pvik
# Conflicts: # src/wp-includes/user.php
Reworked this after the 6.2 revert so it no longer blocks updates to existing users.
Claude did the rework here, details below:
AI Use
Code and description both written with 🤖 Claude Code over a couple of rounds of back and forth. I will review and test.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.