in X-Geek

Drupal To WordPress Migration Snafu

Bah. I’ve found a fault with my hack of the Drupal to WordPress migration script: the authorship of posts isn’t migrated. This typically isn’t a problem if a blog only has one author. For a multi-author blog, though, it can lead to much confusion.

Its easy enough to copy user id’s from one system to another, and so I’ve updated my script to do that. This still doesn’t correctly show authorship, though. The problem for me as a SQL n00b is how to create WordPress’s wp_usermeta table with the appropriate INSERT statements?

Here’s a typical entry in the wp_usermeta database:

+———-+———+—————–+————-+
| umeta_id | user_id | meta_key | meta_value |
+———-+———+—————–+————-+
| 5 | 27 | first_name | Mark |
| 6 | 27 | last_name | Turner |
| 7 | 27 | nickname | Mark Turner |
| 8 | 27 | rich_editing | false |
| 9 | 27 | wp_capabilities | a:0:{} |
+———-+———+—————–+————-+

Here are the fields in Drupal’s users database:

| uid | name | pass | mail | mode | sort | threshold | theme | signature | created | access | status | timezone | language | picture | init | data | login |

How do I create the meta_key entries (first_name, etc.) from the corresponding Drupal fields without using a brain-dead VALUES blahblahblah? There’s gotta be an elegant way to do this.

How about it, Oh Brilliant MT.Net Readers?

UPDATE: After pondering this, I’ve concluded my little SQL script needs loops (and thus grow up into a shell or perl script) in order to make this work right. Correct me if I’m wrong, y’all (and I know you will).