Opened 3 months ago

Last modified 3 months ago

#23430 new enhancement

sanitize_user() disallows + in usernames causes problem for email as username

Reported by: jb510 Owned by:
Priority: normal Milestone: Awaiting Review
Component: Users Version: 3.5.1
Severity: minor Keywords: has-patch
Cc: jbrown510@…

Description

I want to use email addresses as usernames which seems to work fine, except sanitize_user() doesn't allow a + in the username and my email addresses have + in them.

Google/gmail allows one to use a + modifier on emails like so:
user+admin@…, user+editor@…, user+author@…, etc...

I often use this to get around WordPress's requirement for unique email addresses but it's also intended for and useful in filtering: user+blog1@…, user+blog2@…, etc...

Is there a reason we can't allow +'s in usernames or could it be moved to the strict case only?

See formatting.php:892

Attachments (1)

username-patch.patch (499 bytes) - added by mario-siteground 3 months ago.

Download all attachments as: .zip

Change History (4)

  • Cc jbrown510@… added
  • Keywords has-patch added

Tested with +-based username and works for me (creation of posts/pages, editing content, view of author page, user edit page). Adding a quick patch, unless the core team has other preferences.

I want to use email addresses as usernames which seems to work fine

Related: #22367

Note: See TracTickets for help on using tickets.