diff --git a/wp-admin/import/wordpress.php b/wp-admin/import/wordpress.php index 0badf434fd..8cc17b8ee0 100644 --- a/wp-admin/import/wordpress.php +++ b/wp-admin/import/wordpress.php @@ -41,7 +41,7 @@ class WP_Import { function users_form($n) { global $wpdb, $testing; $users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID"); -?> $line) { + $newname = trim(stripslashes($line)); + if ($newname == '') + $newname = 'left_blank'; //passing author names from step 1 to step 2 is accomplished by using POST. left_blank denotes an empty entry in the form. + array_push($formnames, "$newname"); + } // $formnames is the array with the form entered names + + foreach ($_POST['userselect'] as $user => $key) { + $selected = trim(stripslashes($key)); + array_push($selectnames, "$selected"); + } + + $count = count($formnames); + for ($i = 0; $i < $count; $i ++) { + if ($selectnames[$i] != '#NONE#') { //if no name was selected from the select menu, use the name entered in the form + array_push($this->newauthornames, "$selectnames[$i]"); + } else { + array_push($this->newauthornames, "$formnames[$i]"); + } + } + } + function wp_authors_form() { ?>

@@ -127,7 +154,7 @@ class WP_Import { foreach ($authors as $author) { ++ $j; echo '
  • '.__('Current author:').' '.$author.'
    '.sprintf(__('Create user %1$s or map to existing'), '
    '); - $this->users_form($author); + $this->users_form($j); echo '
  • '; } @@ -280,6 +307,7 @@ class WP_Import { $this->id = (int) $_GET['id']; $this->file = get_attached_file($this->id); + $this->get_authors_from_post(); $this->get_entries(); $this->process_categories(); $this->process_posts();