Converting XOOPS N-Sections to WordPress
The Backstory
Back 5 years ago when XOOPS was all the rage, alongside a bunch of other CMSes vying for each and every web developer’s attention, I completed a number of different sites with XOOPS. The problem is that as time has moved on, keeping the sites going on older versions has become tiresome at best and problematic at worst, thus, I am sitting here, writing a quick piece on how to convert N-Sections module data from XOOPS to WordPress posts.
The Need-To-Know
Thanks to this article by Rachel at Cre8d Design, my life has been made a little easier. Her insight and the like-for-like mapping of fields, despite being from stories to WordPress posts was still exceedingly handy. The SQL posted was easily enough edited to use the correct field names from N-Sections, and with the simple addition of INSERT INTO `wp_posts` meant that channeling the data from one table to the other was super easy too. The only real amendment I made to the posted SQL code being to avoid a clash of IDs on the fresh install of WordPress by incrementing the old ID by two as the initial install already includes 2 posts.
The SQL code
SELECT (artid+2) AS ID, 1 AS post_author, FROM_UNIXTIME(date) AS post_date, FROM_UNIXTIME(date +43200) AS post_date_gmt, content AS post_content, title AS post_title, 0 AS post_category, ” AS post_excerpt, ‘publish’ AS post_status, ‘closed’ AS comment_status, ‘closed’ AS ping_status, ” AS post_password, artid AS post_name, ” AS to_ping, ” AS pinged, FROM_UNIXTIME(date) AS post_modified, FROM_UNIXTIME(date +43200) AS post_modified_gmt, ” AS post_content_filtered, “” AS post_parent, ” AS guid, ” AS menu_order, ‘post’ AS post_type, ” AS post_mime_type, 0 AS comment_count FROM `xoops_nseccont`;
The Follow-Up
With this you are ready to go, making the necessary changes to tidy it all up from within the WP-Admin interface. Something lse you might want to consider, at the same time if you wish to port the data, without publishing immediately, then you need to switch out “post_type” from “published” to “draft”. Whilst in addition, if you want to avoid poting old IDs simply replace “artid as ID” for “” as ID” so that MySQL will auto-increment the ID for you.
