When I converted HDTVok.com from phpWebsite to WordPress two years ago, I added user forums with the XDForum plug-in. In fact, the wide availability of plug-ins was a major reason why I chose WordPress for the conversion.

Unfortunately, the authors of XDForum announced they were stopping development of the plug-in in February, which effectively meant it was orphaned as WordPress moved forward. I have no problem with that as it’s easy to get over extended and decide you have to drop things that aren’t generating income.

When I did the conversion to WordPress, I could have chosen to use BBPress for the site’s forums, but at that time it wasn’t part of the WordPress family and as well integrated as far as users go. Because I want to keep all my WordPress sites up to date going forward, I converted the XDForum database to BBPress and this post is an explanation of one way that can be accomplished.

These instructions are for advanced users. You should have access to your WordPress database and the ability to run SQL commands on it. You will likely have to edit the files below so if you’re not comfortable with that, look elsewhere.

The files used to handle this conversion are contained in xdforum2bbpress.zip. There are two files:

  • xdforum.sql — Contains notes on the basic SQL commands used for the conversion of forums, topics and posts. Also, has the basic SQL commands for adding a collection of tags to the database.
  • tagging.php — Once you’ve added the tags, you can run this script once from your server. It will cycle through the tags you added with the first file and add them as tagged with the correct dates.

Using these files, here are steps I went through to convert hdtvok.com’s forums from XDForum to BBPress:

  1. Backup your WordPress database. We hope nothing goes wrong, but if it does you’ll be glad you did.
  2. Install BBPress in your WordPress database on your server and familiarize yourself with its settings and database structure. Since XDForum acted as a WordPress plug-in, you’ll want to set up WordPress integration in BBPress so your users transfer seamlessly. The files included with these instructions assume your $table_prefix is “bb_” and “wp_” for BBPress and WordPress respectively.
  3. Convert xdforums_groups to bb_forums. BBPress doesn’t know about groups so I set them up as forums and then set the XDForums forums as subforums of these. Make a note of the highest xg_id as you’ll need to add that value in the next step and refer to it a few times as convert topics and posts. You’ll also want to delete the default data added with your BBPress installation.
  4. Convert xdforums_forums to bb_forums. The xf_id plus the highest xg_id in the previous step will be the forum_id for these records and we’ll refer back to that in future steps to keep the topics and posts tied to the forums. In my case, I added 8 to each xdforums_forums.xf_id.
  5. Convert xdforums_threads to bb_topics. Since all of these are related to the forums in the previous step, we add the highest xg_id value to xt_xf_id so the forum_id matches. You’ll also want to delete the default data added with your BBPress installation.
  6. Convert xdforum_posts to bb_posts. This is pretty straight forward, but we do discard the xp_subject, which is the title that people give their individual posts. There is no equivalent that I could find in BBPress. You’ll also want to delete the default data added with your BBPress installation.
  7. Cleanup and update bb_topics. At this point, we have the basic data, but need to grab some additional items, like counts, for updating and also clean up the slugs so we can use pretty permalinks.
    • Get the display name for all the topic starters and add it to bb_topics.
    • Get the display name for all the topic last posters from bb_posts and add it to bb_topics.
    • Create a view named “topic_info” that will contain the topic_id, count of posts, first post time stamp, and last post time stamp. There’s probably an easier way to do this, but I couldn’t figure it. We use this to update several items in bb_topics that we didn’t do while converting the data.
    • From the view, update the topic_posts, topic_start_time, and topic_time in bb_topics.
    • Drop the “topic_info” view as we won’t need it again.
    • Clean up the topic_slug field so that certain characters, such as question marks and slashes are deleted. The sql file contains several update statements that do this, but there could be even more that my content didn’t have. This is especially important if you want to use pretty permalinks.
  8. Grab the forum_id from bb_topics and add it to bb_posts. This wasn’t done while converting the bb_posts so it needs to be done now to keep everything straight.
  9. Create and populate the tag tables. This step is somewhat optional, but a nice addition since XDForums didn’t support tagging introduced with WordPress 2.3.
    • Add the tags you want to search for to bb_tags. Because we’ll update the count later, we just need the slug and nice name for the tag. The SQL file contains the tags that I added to my database, but obviously you’ll want to modify that to suit your needs.
    • Run the tagging.php script on your server. You’ll need to edit the database connection information for your database. This script grabs all the tags in the previous step from the database, inserts the tag_id, user_id, topic_id and date of the last post as the tagged_on value in the bb_tagged table.
    • To update the tag count, we create another view named “tag_info” with the tag ID and count so we can update bb_tags with the correct tag count and thus generate the tag cloud/heat map. Again, there’s probably an easier way to do this, but since I was only doing this once I was lazy.
    • Drop the “tag_info” view as we done with it.
  10. Update the counts in BBPress’s admin area under “Manage.”
  11. Check to make sure everything works as expected. When I first did this, my forum counts were off so I had to make some modifications.
  12. At this point, you can optionally delete your XDForum tables, but there’s no technical reason to.
  13. Announce your success to your community.

This worked pretty well for my installation, but I only had a couple of hundred threads, about 600 posts and 50 or so forums. Your mileage may vary.

I looked for something like this, but couldn’t find it. If this saves you some time and you find it useful, consider making a donation to my PayPal account.