I have recently been playing around with Drupal, and I am really enjoying working with it. I already have my forum themed, and set up how I like it, but I would like to import some of my 3500 posts from my old phpBB forum.

The easyist way I can think of right now is to make php function that reads each post from the phpBB database, and inserts it into the Drupal database. But I am having trouble finding all the functions that the forum uses to post new topics.

Could someone point me in the right direction. i.e. How and where the forum module adds new topics, and comments. Or if you have a better way to do it?

Thanks

Comments

Gábor Hojtsy’s picture

I would suggest you post some sample forum items and look into the DB of Drupal.

You will need a taxonomy tree to import the categories set up in phpBB. Then you need to mark some of the elements of the tree as groups. Then if you start any topic, that starts the life as a "node", and all replies are "comments" (look into these tables). The "forum" table holds additional information (basically connects the nodes to terms in the taxonomy). If you use Drupal 4.2.0, efficient comment threadig will be added with the update to 4.3.0. If you use a CVS version (which will become 4.3.0), than you need to reuse the comment threadnig code from the update script in your import script.

It is not at all hard to code, it just takes time IMHO...

CodeMonkeyX’s picture

Yeah thats what I figured. ;) I guess I was hoping there might be a "post_forum_node" function hidded somewhere. :) Then I could just supply it with the correct parameters for each topic.

Oh well I will get cracking ;)

CodeMonkeyX’s picture

I have actually pretty much finished it now.

All I have to do is create an array which links the phpBB forum ids to term ids, and it transfers all topics and comments to the drupal forum. It also add's drupal users as needed.

I still have to add some BBCode processing stuff to make it work correctly, but it should work fine.

JonBob’s picture

You can leave your BBCode markup intact if you enable bbcode.module. It will filter your posts as you are used to.

CodeMonkeyX’s picture

Actually you can not.

In phpBB they append a bbcode_id to every tag in every post.
i.e.

[b:63743662]Some bold text.[/b:63743662]

So I actually had to do a few preg_replaces on every post, but it was not too bad.

scott_’s picture

is this script available for download somewhere? i probably have to convert an old phpbb forum to drupal too :)

CodeMonkeyX’s picture

It is no where near pretty enough yet. ;) Also I just found a little bug in my bbcode conversion function.

oadaeh’s picture

Just curious if you ever finished up that script, or if you even still have it lying around.

downtown70’s picture

Hello,

The Vancouver PHP Association (vancouver.php.net) is thinking about switching to Drupal for our site and I am going to be working on converting the data from phpBB to Drupal forums. I would appreciate hearing from those of you who have started something. I would be happy to put somet time in to cleaning it up for our use. And I will post my finished script as well.

Thanks,

-Dave

sail.daveswave.net

Goalie_Ca’s picture

Cool, i'm an engineering student @ sfu right now. Didn't know of such a user group.

rheo’s picture

I would also like to make this move..

can anyone give me a hand with a link?

eean’s picture

Please. Free me from the oppression of phpbb.

Yasha@spreadfirefox.com’s picture

This really must be a priority as a standard feature if Drupal is going to continue growing. The ability to import from major forums, blogs, and other cms competitors is vital. Not all Drupal users are going to have the code knowledge to do it themselves.