Adding SMF to Coppermine

Bridging; Coppermine comes first, retaining already-registered users.

Here’s one for the webmasters. I recently found myself in a pickle when in one of my sites, I wanted to add a forum to an already-active gallery with registered users. I had installed Coppermine for my gallery simply because it’s what I’ve been using for years now and I like it’s capabilities and flexibility. Coppermine has a built-in bridge manager which allows you to share the users database with that of your forum’s. Normally this would have worked if I had my forum set-up before the gallery, or created them at the same time. When you use the Coppermine bridge manager on an already-active gallery, you adapt the users database of the forum, so the relationships will be lost.

The actual files, user-galleries and database records of your Coppermine installation will not be deleted, but unless your users from the forum and your users from the gallery share the same unique user id, you will have mixed-up user galleries belonging to other users. This is explained very well in Coppermine’s documentation. Assuming you understand how database relationships work and therefore are still with me, let’s now proceed to the next obvious step.

We now know that we need to import the users from Coppermine to your forum software – SMF in this article – and we need to retain their original user’s id. For example – If user admin has a user_id of 1, user star69 has a user_id of 2, we need to retain that in the forum database. There are a couple of ways to do this, and from here it depends on how much database wizardry you know. But, I encountered a problem importing the user passwords to SMF because Coppermine and SMF do not use the same password hash. Coppermine uses MD5 hashing and SMF uses “salted” SHA1 password-hashing. It would have been easy if MD5 could be converted to plain text, but the hash works one-way, and it would take weeks to crack one MD5 hash using brute force.

We now need to find a forum which the same password hashing (MD5) with Coppermine – PhpBB. You can copy and paste the encrypted passwords from Coppermine, add them to PhpBB and let users log-in with the same passwords – all this without exposing the “real” passwords to administrators. Once you have a PhpBB database that has similar users to Coppermine, you now do a fresh install of SMF on a different folder. You then use SMF’s converter for PhpBB which makes it 1-click easy to convert your PhpBB-powered forum to SMF. After that, just use Coppermine’s bridge manager normally.

Really, the only semi-difficult hurdle here is importing your Coppermine database to PhpBB, especially because they don’t share the same (although they are similar) fields. So to make things easier, I created a script that prints (displays) an SQL-written command which import your Coppermine users to PhpBB, and it will retain such fields as user’s email, user’s location, language, apart from their ids, usernames and passwords. You can view the script here. Just copy the content, add your database details (commented in the code), save it to anyfilename.php, upload it to your server, access yoursite.com/anyfilename.php and it will output an SQL code. Copy this SQL code to your phpbb_users’ table – make sure to empty the table first. All of this can be done in PhpMyAdmin if you’re using cPanel. If you have questions, just post a comment here.

See it in action – the Bebot, Bebot! Forum

I did all of this in my site Bebot, Bebot! It’s a babe blog/forum/gallery, but it clearly shows how SMF and Coppermine work together. Clicking “Register” or “Login” from the gallery will direct you to SMF’s login or register page – which is great by the way, because Coppemine is more prone to spambots. By the way, this is also an infomercial for my un-updated babe blog – Bebot, Bebot!

Leave a Reply

Your email address will not be published. Required fields are marked *