Converting from SMF to ExpressionEngine Forum

This will describe how I converted my norwegian webmaster forum which ran the SimpleMachines forum software to ExpressionEngine with the forum module installed.

The SMF_Import module I’ve created can be used to import both users and forum messages to EE, or just the users if you only want to import these.

Please note that the module you can download here (SMF_Import) is not a full module release, but more like a ‘scratch-an-itch’ plugin I created to solve my specific problem (converting

my forum) – so you will need to do some editing to get it to work. The good news is – it worked for me, and it’s not too difficult. Also, if you have problems, just leave me a comment and I’ll try to help you.

Make sure you have EE set to use standard MD5 password encryption (you do this during install). Also note that since SMF uses a seed the passwords cannot be transferred and all your users, including you, will have to go through the forgot password procedure.

How to do it

Downloading the SMF Import module

  1. Download the module here: smf_import.zip
  2. Unzip it in a directory – and open mcp.smf_import.php in a text editor

Edit some settings

At the beginning in mcp.smf_import.php there are a couple of settings:

var $smf_db = "database_name";
var $smf_prefix = "smf_";

Pretty self-explanatory. The smf_prefix is the simplemachines database table prefix (smf_ is standard).

Creating the usergroups

  1. Go to EE Admin -> Usergroups and create the usergroups you want. These may be the same groups you already have in your SMF install, or new ones. The point is that you want to transfer people from to . In my case my SMF install was very messy and I had a lot of different groups – so I ended up with just a few EE groups which was much more managable :)

  2. Go to SMF Admin and check out the usergroups you have there. Now it’s time to link the SMF groups to the EE groups. You already have mcp.smf_import.php open I presume? You need to edit the array around line 90:

    // link SMF membergroups to EE membergroups ... SMF_MEMBERGROUP_ID => EE_MEMBERGROUP_ID
    $smf_ee_membergroup_link = array(
        0 => 5,         // random people?
        1 => 1,         // Admin
        2 => 5,
        3 => 5,
        4 => 5,
        5 => 5,
        6 => 5,
        7 => 5,
        8 => 5,
        9 => 1,
        10 => 5,
        11 => 7,        // VIP
        12 => 6,        // Adult
        13 => 2,        // Banned
        14 => 5,
        15 => 5,
        16 => 5,
        17 => 5
    );
    

Ok, you see what I’ve done here? I’ve linked my SMF usergroup database id’s => EE usergroup database id’s. Pretty simple.

Also, right above that array there are some settings. Please go over them as well:

    $admin_id = 1;          // we don't want to insert a new admin, but update the exisitng EE admin with data from SMF
    $update_only = false;   // default = false, set to true if you run more than one time and only want to update users
    $time_format = 'eu';    // default timeformat for the users
    $language = 'english';  // default language for the users

Creating the forums

The process is the same for the forums as for the usergroups.

  1. Go to the forum administration and add the forums you already have on your old forum (or, new ones, the most important thing is that you have somewhere to transfer the old messages). Make a note of the forum database IDs

  2. Go to SMF admin and make a note of the forum ids.

  3. Edit the section in mcp.smf_import.php, around line 249:

    $smf_ee_forums_link = array(
        2 => 2, // Generelt
        5 => 3, // Offtopic
        7 => 4,
        3 => 5,
        4 => 2,
        34 => 3,
        9 => 2
    );
    

Installing the module

Now that we have everything customized for our need, we’re ready to upload the module.

  1. Copy the mcp.smf_import.php file to modules/smf_import
  2. Copy the lang.smf_import.php to language/
  3. Click “Install” like you usually do with modules

Voilá – and on to the next step:

Importing the users

  1. Go to the “Modules” tab in EE admin
  2. Ok, this might seem a bit weird, but I told you it was scratch-an-itch software so — for some reason you won’t get a clickable “SMF Import” link. Thus, click one of the other modules (e.g. Referer) and replace the end in the URL (e.g. “M=Referer”) with “M=smf_import” –> then you should see the SMF import dialog ;-)
  3. To import the users click “Import SMF users”. This will be a memory intensive operation! (I converted 3000 members and needed to ask my host to up my ram during the operation, anyway).

You should now have imported all users.

Importing the forum posts

  1. Go back to the SMF_import dialog and click “Import forum posts”.
  2. Go to EE Admin tools and run all the “recount statistics” stuff for members and forum ;-)

That’s it.

Enjoy :-)

You can do whatever you want with this script – if you do decide to improve it please drop me a note so I can let everyone know :-) (e.g. one good idea would be to do the users convert in batches instead of all at once).

As a last note – I’ve converted my forum from InvisionBoard, then to phpBB, and finally to SimpleMachines. So, whatever you’re using it should be possible to do the convert (just search around for converters from those others to SMF and use this from SMF to ExpressionEngine. Yes, it’s quite a task but it’s possible ;-)

And if I saved you some time and you feel like buying me a beer my PayPal account is [email protected] :-)

Comments

Comment by Bjørn on 2007-09-02 16:50:04 +0000

Please also note that the module does not copy PM’s.

Comment by carvingCode on 2007-09-04 13:08:29 +0000

Wonderful! I am needing to do this and was searching high and low. I’m converting a cycling website.forum from Joomla/SMF to EE soon. This will be a great help.

Thanks! (You might want to post this to the EE forums.)

Comment by xztheericzx on 2007-11-05 09:37:12 +0000

i’m eric. joining a couple boards and looking forward to participating. hehe unless i get too distracted!

eric

Comment by Matt on 2008-01-21 16:16:25 +0000

Thanks for sharing the script. A quick question: Does this convert and keep track of admin posts for the forums?

Comment by Bjørn on 2008-01-21 17:25:32 +0000

matt – sure :-) .. it won’t insert a new admin, but update the exisitng EE admin with data from SMF (including the messages).

You need to specify the admin_id in the script though (but this is normally 1)

Comment by Matt on 2008-01-23 19:59:38 +0000

Bjorn, thanks just saw this reply (can you subscribe to comment replies somehow?)

here’s another one to stretch you? sorry to be persistent…

If I have the MSM multiple sites manager set up, is it still possible to import into a discreet specific site forum?

thanks, matt

Comment by Bjørn on 2008-01-23 20:59:22 +0000

About comment subscription I know this post has a comments rss feed .. other than that I don’t think there’s a way ..

anyhow, in the script you specify which SMF forums which are imported into which EE forums, so you can import all forums into one if you want yes.

I don’t know if that was what you were asking. When it comes so MSM I don’t have any experience with it, sorry…

Comment by Matt on 2008-01-23 21:52:30 +0000

ok, no problem thanks for your quick reply.

(you can get a wp plugin which allows people to subscribe to comments, if that floats your boat)

cheers, mlh

Comment by Bjørn on 2008-01-23 23:02:07 +0000

Yeah, I ought to convert this blog to EE anyway so ;-)

Comment by Richard on 2008-02-27 06:32:57 +0000

Thank you very much for this script. It helped me tons! I was very worried about this element of the transition. I love it when people post the solution to their own problem. I think it really helps people learn. Too bad not everyone does it. There would be much more sanity and much less computer pieces.

Comment by Miko on 2008-07-04 12:16:17 +0000

hi!

great script!! I have a little question, maybe not the right place to ask :p So I’m checking the ID’s of my EE boards and SMF boards, EE no problem, but SMF where can I find this?

Comment by Bjørn on 2008-07-04 12:39:20 +0000

Hi Miko,

check the links, e.g. http://www.simplemachines.org/community/index.php?board=19.0

it has id 19.

Comment by Miko on 2008-07-04 13:20:51 +0000

Hi,

Ok super, it was obvious :p thanks :)

Comment by Miko on 2008-08-03 02:34:19 +0000

Hello Bjorn,

Can I send you an email, I’ve got an error while converting the topics + posts :(

Thanks :)

Comment by bjorn on 2008-08-03 03:37:25 +0000

miko – post it here, that way people can learn from it.

Comment by Miko on 2008-08-03 11:39:33 +0000

Hello,

Allright, no problemo :) When I start the import of my posts, I get this error: MySQL ERROR:

Error Number: 1062

Description: Duplicate entry ‘3’ for key 1

Query: INSERT INTO exp_forum_topics (topic_id, forum_id, author_id, ip_address, title, body, status, sticky, topic_date, topic_edit_date, topic_edit_author, thread_total, thread_views, last_post_date, last_post_author_id, last_post_id) VALUES (‘3′, ’18’, ‘1’, ‘82.146.105.176’,

Import off users no problem.

Any idea?

Comment by Bjørn on 2008-08-03 12:06:15 +0000

The problem is that you haven’t started with a fresh install of your EE forum (there are existing topics in it).

You can delete the existing topics in SQL this way:

DELETE FROM exp_forum_topics

That should be enough. If that doesn’t work you should start off with a clean EE install/forum install.

Comment by Chris MacPherson on 2008-08-27 17:52:38 +0000

Hi, How do you deal with the banned users from SMF? SMF doesn’t appear to use a specific id for banned users, whereas EE does.

Comment by Chris MacPherson on 2008-08-27 18:38:00 +0000

The reason your link is not activated in the EE modules list in the control panel is because in the code at lines 448, 553, 559, 562 and 565 you are not using the class name. Instead you are using the $module_name which is incorrect.

I had a similar problem while devoping another module. Hope that helps.

Comment by Chris MacPherson on 2008-08-27 18:40:03 +0000

Sorry, just to make that a little clearer! The value to be used in the lines mentioned above would be ‘Smf_import’ which is the class name in the mod file, not the class name in the control panel file.

Comment by Bjørn on 2008-08-27 18:58:49 +0000

Chris – I would just delete the banned users in SMF before importing, seems like the easiest solution to me.

That said, SMF must have some way of knowing what users are banned (maybe a specific usergroup?), so it should only be a matter of a couple of SQL-statements to make them banned in EE after transferring.

btw – thanks for the solution to my link-problem :) I don’t think I’ll bother updating/testing this script, since as I stated it’s not a module release but just a fix for my specific problem. But now I know for next time. thanks.

Comment by Chris MacPherson on 2008-08-27 19:12:45 +0000

That’s the conclusion I was coming to I think – delete all the banned users. I guess they are not useful for anything.

Thanks for the code anyway as it’s really helped me sort my problem out. I’m probably going to further modify this script. I’ll make sure to post back with my results.

Comment by Bjørn on 2008-08-27 20:25:13 +0000

No problem, feel free to improve the script and publish it :-)