The MU forums have moved to WordPress.org

Changing author on many posts after import (17 posts)

  1. mars-hill
    Member
    Posted 15 years ago #

    I'm (still!) in the process of moving multiple WP blogs into one WPMU site.

    The problem I'm having is overlapping author IDs.

    e.g. "Craig" was ID#1 on the WP blog, but is ID#7 in the new WPMU blog. The freshly imported tables don't reflect this and therefore show the wrong author.

    Is there any way to batch-change post_author from ID#1 to ID#7 using phpMyAdmin or something similar? Or is there something really basic that I've missed?

    There are over 200 posts for some users, so I'd really like to avoid doing this one by one. Any ideas welcome.

  2. dsader
    Member
    Posted 15 years ago #

    Freshly Imported Tables?

    How are you importing tables from WP to WPMU?

    Rhetorical, you can't.

    Use the Dashboard-->Manage-->Export on the WP blogs to generate an xml file for each
    Then use Dashboard-->Manage-->Import on each WPMU blog(set authors to map to authors via a drop down thingy).

    May have to change max_upload_filesize(php.ini) if they are big files(and SiteAdmin-->options Max upload filesize).

  3. mercime
    Member
    Posted 15 years ago #

    What dsader said. And creating authors before the XML import would be worth it because you won't need to search and assign posts to users later on.

  4. andrea_r
    Moderator
    Posted 15 years ago #

    What they both said. I'm doing this on a large single-blog conversion to MU and it's a freaking nightmare.

    Especially with post revisions thrown in. :)

    (40+ meg export file, folks. And the web host won't raise the file limit more than 8 megs)

  5. mercime
    Member
    Posted 15 years ago #

    Wow, what a nice challenging project andrea_r! I had bookmarked a WP.org forum topic on how to cut down XML into portions (no solution given) http://wordpress.org/support/topic/134481?replies=9 and was mulling over how it can be done if XML was all that was left of the old site. If the site was still up, I would export per user. But if only one user, the same dilemma.
    Good luck!

  6. andrea_r
    Moderator
    Posted 15 years ago #

    No solution given?

    I bet the crusties over there just refused to, because if you read the export file, it's kinda obvious. I've chunked that export file above into 30+ pieces because it kept timing out over 2 megs (on top of everythign else)

    There's a bunch of stuff at the top of the file, and a couple lines at the bottom. That's what you need in each file. posts and other content are wrapped in < item > tags.

    (hmm, some day I should tutorialize this)

  7. cafespain
    Member
    Posted 15 years ago #

    (hmm, some day I should tutorialize this)

    I say that to myself everyday (amongst other things), but it never happens.

  8. tdjcbe
    Member
    Posted 15 years ago #

    40 megs for a 200 post blog sounds a bit large. (Actually very large.) Please make sure that you are deleteing any spam first before exporting. Since it's not been dealt with, they get exported out along with the content that you want.

  9. andrea_r
    Moderator
    Posted 15 years ago #

    I did. There's hardly any spam, that's the first thing I checked. The bloat is since they upgrade the single blog to 2.6 and the post revisions were turned on. 17 megs of that was July and August.

    The posts table in the db accounted for almost half the db size.

    It's also a popular blog with multiple authors and multiple daily posts. Surprisingly, they did not have multiple pages of comments. But they did have about 5,000 tags. :)

    Edit: I think you got confused a bit. mars-hill said he had 200 posts, and *I* said the one I was working on (a completely different blog) had a 40+ meg export file. There's 3500 + posts in that one.

  10. Trent
    Member
    Posted 15 years ago #

    My export file on my personal blog is about 22 megs now with over 2,000 posts and few tags and before upgrading to 2.6 it was about 8 megs. It doesn't have any spam in it, but it seems somewhere along the way it was given some bloat and I don't know why (plugins maybe). I wish my "idea" about breaking up the export process would be considered ;)

    Trent

  11. mars-hill
    Member
    Posted 15 years ago #

    [quote]Freshly Imported Tables?

    How are you importing tables from WP to WPMU?

    Rhetorical, you can't.[/quote]

    Can't I? I used phpMyAdmin to pull all the wp_ tables from the original database, made a new WPMU blog (for example wp_2_) then did a search/replace on the SQL file to change wp_ to wp_2_, dropped the (script generated) wp_2_ tables from the WPMU database then replaced them with my doctored "new" ones.

    This has the advantage of keeping all my plugin options, etc.

    So the best option for mapping authors is really to do the WP export? There's no way to search/replace these values within phpMyAdmin?

    (It's only one piece of data, dammit!)

  12. andrea_r
    Moderator
    Posted 15 years ago #

    Yeeeeaaah... the users might be messed up. :-/

    Did you check the lists in the backend? Did they get mapped to the right blog?

  13. mars-hill
    Member
    Posted 15 years ago #

    They seem to be mapped OK, but (as you say) everything's messed up. If I change the post_author from one value to another it fixes things easily...but I'd love a way to do this "automatically".

  14. cafespain
    Member
    Posted 15 years ago #

    UPDATE wp_x_posts SET post_author = 7 WHERE post_author = 1;

  15. mercime
    Member
    Posted 15 years ago #

    andrea_r, looking forward to your tutorial, just in case... :-) The info I saw about cutting the XML to manageable sizes in Codex is not that extensive - a one liner in fact :-)

    mars-hill: This has the advantage of keeping all my plugin options, etc.

    Many WP plugins not compatible with WPMU, so XML is better and cleaner import. Good luck.

  16. mars-hill
    Member
    Posted 15 years ago #

    Thanks all. cafespain's SQL query has worked well.

    @mercime: You're right, but most of mine (all but two, I think...let's see what happens) were compatible so I decided to go this route. It was just this that stymied me.

  17. PetLvr
    Member
    Posted 15 years ago #

    just passing by ...// on March 1, 2009 I consolidated 15 subdomains into 1 domain on regular WPv2.7.1 and had export files greater than 20MB in size. Following the codex you adjust your .htaccess to the 64MB for both mem & filesize, but that never worked. However if you zip it into a .gz file and import THAT instead of the XML it imports everything perfectly fine (at least it did for me) //

About this Topic

  • Started 15 years ago by mars-hill
  • Latest reply from PetLvr