[wp-trac] [WordPress Trac] #33376: Create index on user_email and UNIQUE on user_nicename, user_email and user_login

WordPress Trac noreply at wordpress.org
Sat Aug 15 00:50:10 UTC 2015


#33376: Create index on user_email and UNIQUE on user_nicename, user_email and
user_login
------------------------------------------+-----------------------------
 Reporter:  chriscct7                     |       Owner:  chriscct7
     Type:  enhancement                   |      Status:  assigned
 Priority:  normal                        |   Milestone:  Future Release
Component:  Database                      |     Version:
 Severity:  normal                        |  Resolution:
 Keywords:  has-patch dev-feedback early  |     Focuses:  performance
------------------------------------------+-----------------------------

Comment (by chriscct7):

 Replying to [comment:2 knutsp]:
 > This may fail for user_email, as a plugin could have allowed users with
 the same email.

 Replying to [comment:2 knutsp]:
 > This may fail for user_email, as a plugin could have allowed users with
 the same email.

 To do so would either require direct SQL calls or overriding tons of
 checks for email_exists in order to avoid the fact that WordPress prevents
 users from sharing an email address. I'm sure a plugin could be devised,
 if so desired, that could break on any nearly any change to WordPress
 core.

 A plugin that allows the same email to be shared would also break other
 issues like #9568 (login via an email address; which user gets logged in
 when they share an email?), as well as developers ability to count on
 predicable results to core functions like `get_user_by('email', $value)`.
 As such, changing the tables to not support duplicates simply complements
 checks WordPress already has.

 If it was desired, we could skip the upgrades on existing installs (patch
 for that attached), but in any case. A better option would be to query all
 rows where duplicates exist and update the emails to be
 `username+{email}`. Patch also attached for this.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33376#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list