Forum Integration

Note: this is one of a series of posts about the creation of the King Design web site.

In moving my commercial software resources over to the King Design site, I wanted to bring over the relevant forums from Of course I wanted to keep using the excellent PunBB (especially with the yummy XHTML compliance in 1.2) as I’ve been quite pleased using it to drive the forums. The PunBB 1.2 release preceded my new site launch quite nicely, so I was able to work on 1.2 exclusively for the King Design forums. I tried not to make too many changes, but I did need to do a little tweaking to get things working the way I wanted them to.

Data Migration

My initial plan was to create a copy of the forum database and remove the posts from other categories; while removing the opposite posts from the forums. This would bring over the user database as well, but after the initial migration the user databases would be separately updated. Going with two databases would give me clean separation betwee then two forums, but I wasn’t entirely sure that was what I wanted.

After thinking about various options, I finally decided on a hybrid solution that I thought would work. I would create a copy of the configuration options table for the new King Design forums, but I’d share post data and user data between the two forums. I sent a quick e-mail to Rickard (the PunBB developer) as a sanity check and he didn’t see any immediate problems – actually he was curious to see how it would work.

A search through the PunBB source revealed a handful of places where data was read from or written to the config table, so I hardcoded the table name in those places to point to my King Design forums config table (a copy of the config table from the forums). Then I updated the options in the King Design forums and bingo – the King Design forums were reading config settings from the new table.

I added some code to the forum home page to filter out/in the categories I want to display, and added code to the viewforum and viewtopic pages to redirect moved posts from the forums to the King Design forums. I saw that Google was already picking up some of the 301 headers and updating their indexes.

Another benefit of sharing the main data tables between the forums is a shared username and password for my forum users. Information updated on one forum is also updated on the other.

Sharing data also gives me great flexibility for the future. If I want to move an additional forum to the King Design site, or one of the forums on King Design back to, I can do so quite easily.

The separation between the forums isn’t 100% complete yet. I haven’t decided the best way to exclude posts in the search results, or categories and forums from the drop down menus. The search queries are not as modular as I’d like, so I think I need to add category exclusion code to each query. I’m still noodling on a better solution.

Look and Feel

PunBB does a good job making it possible to customize the look and feel fo the forums without having to modify core code. You can create a template for the main site structure, then your own CSS theme to handle the details. Since I wanted to integrate the forums with my site look and feel, I created a PunBB template from my main page template, then started tweaking the CSS to match. I then removed the rest of the styles since I wanted to maintain my site’s look and feel.

Customizations and Mods

I think PunBB is great out of the box, but there is some extra functionality that I like to add in. The first is my Active Topics mod. This shows the latest posts from all forums in one list. Very handy for seeing what is going on if you visit the forums on a daily or semi-daily basis.

The second change is the addition of RSS feeds with full post data, with feeds for categories, forums and topics. The current RSS feeds are based on another RSS mod for PunBB, using code from Blog:CMS which I’m not entirely wild about. I’ll probably continue to rewrite and improve them when I have more time.

This post is part of the project: Tasks Pro™. View the project timeline for more context on this post.