summaryrefslogtreecommitdiffstats
path: root/wp-admin/import/wordpress.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-09-08 10:57:32 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-09-08 10:57:32 +0000
commite30516b2ee40c1c45c8f288c20a3d4372e478624 (patch)
treebd6b8bcc4c06697f50e6985a6b08620e25bc572e /wp-admin/import/wordpress.php
parente20c9aa016d6885c6e3fc7425525b4090f05ac2a (diff)
downloadwordpress-mu-e30516b2ee40c1c45c8f288c20a3d4372e478624.tar.gz
wordpress-mu-e30516b2ee40c1c45c8f288c20a3d4372e478624.tar.xz
wordpress-mu-e30516b2ee40c1c45c8f288c20a3d4372e478624.zip
WP Merge to #4124
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@734 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/import/wordpress.php')
-rw-r--r--wp-admin/import/wordpress.php35
1 files changed, 29 insertions, 6 deletions
diff --git a/wp-admin/import/wordpress.php b/wp-admin/import/wordpress.php
index 997628b..ded4b94 100644
--- a/wp-admin/import/wordpress.php
+++ b/wp-admin/import/wordpress.php
@@ -54,8 +54,24 @@ class WP_Import {
global $wpdb;
//mtnames is an array with the names in the mt import file
$pass = 'changeme';
- $key = array_search($author, $this->mtnames); //find the array key for $author in the $mtnames array
- $user_id = username_exists($this->newauthornames[$key]); //use that key to get the value of the author's name from $newauthornames
+ if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
+ ++ $this->j;
+ $this->mtnames[$this->j] = $author; //add that new mt author name to an array
+ $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
+ if (!$user_id) { //banging my head against the desk now.
+ if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
+ $user_id = wp_create_user($author, $pass);
+ $this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank.
+ } else {
+ $user_id = wp_create_user($this->newauthornames[$this->j], $pass);
+ }
+ } else {
+ return $user_id; // return pre-existing wp username if it exists
+ }
+ } else {
+ $key = array_search($author, $this->mtnames); //find the array key for $author in the $mtnames array
+ $user_id = username_exists($this->newauthornames[$key]); //use that key to get the value of the author's name from $newauthornames
+ }
return $user_id;
}
@@ -96,6 +112,13 @@ class WP_Import {
$formnames = array ();
$selectnames = array ();
+ foreach ($_POST['user'] as $key => $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");
@@ -125,7 +148,7 @@ class WP_Import {
$j = -1;
foreach ($authors as $author) {
++ $j;
- echo '<li>Current author: <strong>'.$author.'</strong><br />'.'Map to existing: ';
+ echo '<li>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30"> <br />');
$this->users_form($j);
echo '</li>';
}
@@ -140,7 +163,7 @@ class WP_Import {
$file = wp_import_handle_upload();
if ( isset($file['error']) ) {
$this->header();
- echo '<p>Sorry, there has been an error.</p>';
+ echo '<p>'.__('Sorry, there has been an error.').'</p>';
echo '<p><strong>' . $file['error'] . '</strong></p>';
$this->footer();
return;
@@ -225,7 +248,7 @@ class WP_Import {
}
} }
if ( $num_comments )
- printf(__(' (%s comments)'), $num_comments);
+ printf(' '.__('(%s comments)'), $num_comments);
// Now for post meta
preg_match_all('|<wp:postmeta>(.*?)</wp:postmeta>|is', $post, $postmeta);
@@ -243,7 +266,7 @@ class WP_Import {
wp_import_cleanup($this->id);
- echo '<h3>'.sprintf(__('All done. <a href="%s">Have fun!</a>'), get_option('home')).'</h3>';
+ echo '<h3>'.sprintf(__('All done.').' <a href="%s">'.__('Have fun!').'</a>', get_option('home')).'</h3>';
}
function import() {