[wp-trac] [WordPress Trac] #13130: WP Import with Multiple Authors Fails

WordPress Trac wp-trac at lists.automattic.com
Fri May 7 14:05:05 UTC 2010


#13130: WP Import with Multiple Authors Fails
--------------------------+-------------------------------------------------
 Reporter:  technosailor  |       Owner:                        
     Type:  defect (bug)  |      Status:  new                   
 Priority:  high          |   Milestone:  3.0                   
Component:  Import        |     Version:                        
 Severity:  blocker       |    Keywords:  has-patch dev-feedback
--------------------------+-------------------------------------------------
Changes (by blepoxp):

  * keywords:  has-patch needs-testing dev-feedback => has-patch dev-
               feedback


Comment:

 Sorry... this wound up longer than i originally intended.

 I did a little testing this morning after the dev meeting yesterday. nacin
 was concerned that yoavf's patch would create vulnerabilities with other
 places in the code that call this function. If the goal for 3.0 is to
 simply fix the importer breaking when multiple users are imported with
 empty strings for their email address, then yoavf's patch will work and we
 can develop better functionality for the dup checks in 3.1.

 yoavf's patch doesn't cause any undesired side effects while creating
 users via admin or while creating new users from the front end
 registration. Each of those functions checks for existence of a correctly
 formatted email before passing the data to wp_insert_user().

 If a plugin, theme, or other importer does get to wp_insert_user() with an
 empty string for an email address, yoavf's patch will not cause any
 greater 'bug' in functionality than 2.9 did.

 2.9 (all 'already registered' emails get through if they made it to this
 function):
 {{{
 if ( empty($user_email) )
     $user_email = '';
 $user_email = apply_filters('pre_user_email', $user_email);
 }}}

 3.0 (no 'already registered' emails get through if they made it to this
 function):
 {{{
 if ( empty($user_email) )
     $user_email = '';
 $user_email = apply_filters('pre_user_email', $user_email);

 if ( !$update && email_exists($user_email) )
    return new WP_Error('existing_user_email', __('This email address is
 already registered.') );
 }}}

 yoavf's patch (only 'already registered' emails with empty strings get
 through if they made it to this function):
 {{{
 if ( empty($user_email) )
     $user_email = '';
 $user_email = apply_filters('pre_user_email', $user_email);

 if ( !$update && email_exists($user_email) && '' != $user_email )
    return new WP_Error('existing_user_email', __('This email address is
 already registered.') );
 }}}

 If we're still concerned about unforseen bugs as a result of this, we
 could use the following code until a better function is developed in 3.1:
 {{{
 if ( !$update && email_exists($user_email) ) {
     if ( ! isset( $_GET['import'] ) && 'wordpress' != $_GET['import'] )
         return new WP_Error('existing_user_email', __('This email address
 is already registered.') );
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13130#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list