Make WordPress Core

Opened 15 years ago

Closed 13 years ago

Last modified 13 years ago

#10319 closed defect (bug) (fixed)

WordPress import fails to create new users

Reported by: yoavf's profile yoavf Owned by: yoavf's profile yoavf
Milestone: 3.1 Priority: normal
Severity: normal Version: 2.8
Component: Import Keywords: has-patch early
Focuses: Cc:

Description

When an xml import file contain user names with characters other than [a-z][A-Z], importer still asks if you'd like to import the author.

Problem: Usernames cannot have these characters in them.
The author is not imported, and all posts are mapped to the default user (admin ?)

Possible solutions

  1. Do not display the "Import Author" line for those usernames
  1. Display error/warning that the user wasn't imported and that posts were mapped to user "XXX"

Attachments (1)

wp30-import-users.diff (759 bytes) - added by yoavf 14 years ago.

Download all attachments as: .zip

Change History (18)

#1 @Denis-de-Bernardy
15 years ago

  • Milestone changed from Unassigned to 2.9

Or 3., we sanitize the username accordingly.

#2 @janeforshort
14 years ago

  • Milestone changed from 2.9 to Future Release

Punting due to lack of patch.

#3 @westi
14 years ago

Saw this investigating #11484.

Nub of the issue is that export files contain display name which is not user_login safe and sanitize_user can strip it down to an empty username.

#4 @westi
14 years ago

#11548 - Will remove the ability to create duff users but not yet fix the importer.

#5 @westi
14 years ago

(In [12469]) Fix some notices in the importer when importing files from old WordPress versions or not fetching attachments. See #11484.
Ensure that we check that a user is created for the username we specify and otherwise fallback to the current user
See #10319.

#6 @westi
14 years ago

  • Cc westi added
  • Keywords needs-patch added
  • Milestone changed from Future Release to 3.0

That improves this a bit.

Would be great to improve the UX some more in 3.0 to detect the invalid username earlier and offer a better solution that then current fallback.

#7 follow-up: @hakre
14 years ago

What is an invalid / a valid username? We could create a validation function then and deal accordingly with valid / invalid usernames as needed.

#8 in reply to: ↑ 7 @westi
14 years ago

Replying to hakre:

What is an invalid / a valid username? We could create a validation function then and deal accordingly with valid / invalid usernames as needed.

It gets passed through sanitize_user($user_login, true) so the valid name has to match all the rules there.

The big problem at the moment is what to do when the username has no valid chars in it.

I suspect we should modify the first step to show the usernames which will be created and allow the user to change them if no good.

Something like:

Username in import - Username when imported - Use existing user
דיסוננס קוגניטיבי - imported_user_1 (o) [admin\/]

#9 @hakre
14 years ago

sanitize_user($user_login, true)

does not support utf8, allowed chars for a wordpress username are:

WPUSERNAME ::= [a-zA-Z0-9 _.@-]+ while duplicate spaces are not allowed

#11 @hakre
14 years ago

user names als here: #11753

#12 @yoavf
14 years ago

  • Owner set to yoavf
  • Status changed from new to assigned

#13 @yoavf
14 years ago

  • Keywords has-patch added; needs-patch removed

Why not leave the username field empty for those users?
If the users leave that empty, posts will automatically assigned to the first user.
wp30-import-users.diff does that

#14 @nacin
14 years ago

  • Keywords removed

We should still esc_attr it I think. Looks fine to me though. Might be a little late in the development cycle? I suppose all that would be hurt is that more posts would be mapped to users, instead of to the admin.

#15 @nacin
14 years ago

  • Keywords early added
  • Milestone changed from 3.0 to 3.1

#16 @nacin
13 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [15961]) Importer and exporter overhaul, mega props duck.

Exporter overhaul:

  • Add author information to export
  • Greater usage of slug identifiers
  • Don't export auto-drafts, spam comments, or edit lock/last meta keys
  • Inline documentation improvements
  • Remove filtering for now (@todo)
  • Bump WXR version to 1.1, but remain back compat in the importer

Importer overhaul (http://plugins.trac.wordpress.org/changeset/304249):

  • Use an XML parser where available (SimpleXML, XML Parser)
  • Proper import support for navigation menus
  • Many bug fixes, specifically improvements to category and custom taxonomy handling
  • Better author/user mapping

Fixes #5447 #5460 #7400 #7973 #8471 #9237 #10319 #11118 #11144 #11354 #11574 #12685 #13364 #13394 #13453 #13454 #13627 #14306 #14442 #14524 #14750 #15055 #15091 #15108.

See #15197.

#17 @nacin
13 years ago

  • Milestone changed from Awaiting Triage to 3.1
Note: See TracTickets for help on using tickets.