WordPress.org

Plugin Directory

Changeset 401649


Ignore:
Timestamp:
06/27/11 10:49:20 (3 years ago)
Author:
duck_
Message:

Workaround Multisite lowercase login names, see http://is.gd/Di73JP

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wordpress-importer/trunk/wordpress-importer.php

    r380920 r401649  
    336336 
    337337        foreach ( (array) $_POST['imported_authors'] as $i => $old_login ) { 
     338            // Multsite adds strtolower to sanitize_user. Need to sanitize here to stop breakage in process_posts. 
     339            $santized_old_login = sanitize_user( $old_login, true ); 
    338340            $old_id = isset( $this->authors[$old_login]['author_id'] ) ? intval($this->authors[$old_login]['author_id']) : false; 
    339341 
     
    343345                    if ( $old_id ) 
    344346                        $this->processed_authors[$old_id] = $user->ID; 
    345                     $this->author_mapping[$old_login] = $user->ID; 
     347                    $this->author_mapping[$santized_old_login] = $user->ID; 
    346348                } 
    347349            } else if ( $create_users ) { 
     
    363365                    if ( $old_id ) 
    364366                        $this->processed_authors[$old_id] = $user_id; 
    365                     $this->author_mapping[$old_login] = $user_id; 
     367                    $this->author_mapping[$santized_old_login] = $user_id; 
    366368                } else { 
    367369                    printf( __( 'Failed to create new user for %s. Their posts will be attributed to the current user.', 'wordpress-importer' ), esc_html($this->authors[$old_login]['author_display_name']) ); 
     
    373375 
    374376            // failsafe: if the user_id was invalid, default to the current user 
    375             if ( ! isset( $this->author_mapping[$old_login] ) ) { 
     377            if ( ! isset( $this->author_mapping[$santized_old_login] ) ) { 
    376378                if ( $old_id ) 
    377379                    $this->processed_authors[$old_id] = (int) get_current_user_id(); 
    378                 $this->author_mapping[$old_login] = (int) get_current_user_id(); 
     380                $this->author_mapping[$santized_old_login] = (int) get_current_user_id(); 
    379381            } 
    380382        } 
Note: See TracChangeset for help on using the changeset viewer.