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:
  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] :-)

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

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

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


  3. 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)

  4. 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

  5. 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…

  6. 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

  7. 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.

  8. 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?

  9. 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′, ’′,

    Import off users no problem.

    Any idea?

  10. 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.

  11. 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.

  12. 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.

  13. 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.

  14. 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.

  15. 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.

Leave a Reply