[wp-trac] [WordPress Trac] #30647: wp_update_user() allows using existing user_email, user_login, and user_nicename

WordPress Trac noreply at wordpress.org
Wed Dec 10 16:04:49 UTC 2014


#30647: wp_update_user() allows using existing user_email, user_login, and
user_nicename
------------------------------------------------+--------------------------
 Reporter:  danielbachhuber                     |       Owner:
     Type:  defect (bug)                        |      Status:  new
 Priority:  normal                              |   Milestone:  Future
Component:  Users                               |  Release
 Severity:  normal                              |     Version:
 Keywords:  dev-feedback has-patch 2nd-opinion  |  Resolution:
                                                |     Focuses:
------------------------------------------------+--------------------------
Changes (by rittesh.patel):

 * keywords:  needs-patch dev-feedback => dev-feedback has-patch 2nd-opinion


Comment:

 {{{
 if ( ! $update && ! defined( 'WP_IMPORTING' ) && email_exists( $user_email
 ) )
 }}}

 Here $update is playing a critical role. In case of new user, $update will
 be false hence `email_exist` condition will be checked resulting in an
 error saying `Sorry, that email address is already used!`.

 But, when we update an existing user, email_exist will not be checked at
 all since the very first check for `$update` will fail itself.

 And anyhow `email_exist` condition should be checked for all the cases.
 Hence I've removed `$update`. I'm not sure about `WP_IMPORTING` hence kept
 it as it is.

 Dev suggestions will be appreciated if I'm missing anything.

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


More information about the wp-trac mailing list