[wp-hackers] Is it safe to change users usernames ?

Andrew Nacin wp at andrewnacin.com
Sun May 22 22:44:08 UTC 2011


On Sun, May 22, 2011 at 6:17 PM, Lox <lox.dev at knc.nc> wrote:

> Hello,
>
> I am working on a web site that requires that users username and email have
> to be the same (users should be able to login using their email address)
>
> So when a user changes its email address, I want that its username to
> change. That part is ok, I can do it.
>
> My question is: is it safe? Are there any possible side effects of doing
> it?
>

Possible side effects include:
 -  If their user_nicename also changes, then their /author/$name URLs will
break. That said user_nicename is different from email, so that's
manageable.
 - You need to make sure to properly invalidate the cache for a username
change.
 - Nausea, dry mouth, blurred vision, headache.*

That said:

It's one thing to allow username changes, but I don't think your use case is
the right one. Rather, there are plugins and hooks available to allow you to
authenticate based on email, rather than making the username equal the
email.

Thus: http://wordpress.org/extend/plugins/wp-email-login/

See also: http://core.trac.wordpress.org/ticket/9568

Nacin

* If any side effects last more than four hours, please consult your
developer.


More information about the wp-hackers mailing list