Moving from XOOPS to Wordpress

September 13, 2006

Wordpress offers a simple way to import content from many other blogging systems (details here) but what happens when your system isn’t listed there? Moving from one system to another isn’t necessarily a nightmare - especially if all your data is already in a database. I recently moved a lot of content over from a system called XOOPS to Wordpress. I had a hunt around to see if anyone else had done this and think I found a couple of perl scripts but they weren’t applicable to what I was wanting to do and I wanted to feel comfortable importing in the content.

The only thing I wanted to bring across from XOOPS were all the stories - these would be turned into Wordpress blog posts. It’s a very simple case because there is only one author, one category and no comments on the XOOPS content.

I had a look at how XOOPS was storing this content in the database using phpMyAdmin and compared this to how Wordpress stores its blog posts and matched up the XOOPS table fields with the Wordpress ones where possible.

Xoops Wordpress
title post_title
storyid ID
post_author = 1
post_category = 0
post_status = publish
comment_status = open
ping_status = open
hometext post_excerpt
bodytext post_content
FROM_UNIXTIME(post_date) post_date
FROM_UNIXTIME(published+43200) post_date_gmt
FROM_UNIXTIME(post_date) post_modified
FROM_UNIXTIME(published+43200) post_modified_gmt
storyid post_name

Note:

  1. The content in this case was all written by one person so I didn’t need to worry about the author id but XOOPS stores this as uid. If there were a number of authors, the author data could be exported and imported into Wordpress too.
  2. The content wasn’t categorised (it’s organised by date only) so I didn’t need to worry about categories but this could be exported and imported too.
  3. XOOPS and Wordpress store their dates differently so I had to do a quick conversion between formats. The “+43200″ is the difference between New Zealand time and GMT.

Once this table matching had been done, this was converted into a MySQL statement:

SELECT storyid AS ID, 1 AS post_author, FROM_UNIXTIME( published ) AS post_date, FROM_UNIXTIME( published +43200 ) AS post_date_gmt, bodytext AS post_content, title AS post_title, 0 AS post_category, hometext AS post_excerpt, 'publish' AS post_status, 'closed' AS comment_status, 'closed' AS ping_status, '' AS post_password, storyid AS post_name, '' AS to_ping, '' AS pinged, FROM_UNIXTIME( published ) AS post_modified, FROM_UNIXTIME( published +43200 ) AS post_modified_gmt, '' AS post_content_filtered, "" AS post_parent, '' AS guid, '' AS menu_order, "" AS post_type, '' AS post_mime_type, 0 AS comment_count FROM `xoops_stories`

The resulting data was then imported into Wordpress.

Again, this was a nice and simple example because there were no comments on the entries so only one table was being exported from XOOPS. If you already have posts in Wordpress, you’ll need to be more careful about the IDs not conflicting with older entries as well. Since this was a new Wordpress install, I didn’t have this problem.

I also needed to update Wordpress’ post2cat by importing this data into it:

SELECT "" as rel_id, storyid AS post_id, 1 as category_id FROM `xoops_stories`

This matches up categories with the posts.

If you need to move from one system to another and there’s no automated convertor, it can often be quite simple to figure out what to do to convert.

Comments
  1. One thing that’s often overlooked is the ability to extract the full site to RSS - some services offer this. Even if they don’t offer it directly, if you’re up to a little bit of hackery, it shouldn’t be too hard to generate an ‘all posts’ RSS file.

    Wordpress has, built in, the ability to import from RSS - very handy in these situations :)

    Andrew, September 13, 2006

  2. Good point. That’s one of the reasons we moved away from XOOPS, the version it was running had no feeds and upgrading it would break some modules.

    Rachel, September 13, 2006

  3. Hi Rachel,

    While surfing the net true my bookmark list, I found out that your mainsite is hacked. Am I correct?

    I followed the Vaniliaforum walkthrough on my homeserver, and it is done very easy. Thanks for the blog!

    Redstar, September 17, 2006

  4. Site’s working fine for me Redstar?

    Rachel, September 17, 2006

  5. http://www.cre8d-design.com/designerblogs/ this one is yours not? I see a message that the site is hacked.

    Redstar, September 19, 2006