Howdy Folks,

I have a small site using Joomla. I would like to migrate my usernames and passwords from Joomla to Drupal. I don't really care about anything else. Can this be done just by copying the usernames and the password hashes to the Drupal users table? Has anyone done this before? Thanks in advance.

Comments

gareth_w’s picture

but not got round to tackling it yet.

I was going to try it and hope (hey, this strategy's worked before. Not very often, granted, but...) as the same hashing algorithm seems to be in use.

However, if it does not work then I was going to put a big sign on the front page requesting returning users to "request new password". Seeing as this will go to the original e-mail address there should be no chance of spoofing, then everyone who moves over will be straight set up with no bother.

If you do find an elegant solution, I'd love to know!

Gareth

laceiba’s picture

I am gonna try it and see. Quite honestly, the most difficult part is going to be interacting with MySQL through a web interface (I'm on a shared host). I'm comfortable with MS Access, but MySQL is a bit of a black box to me. I will reply back to this thread with my results.

gareth_w’s picture

Drop me a line if you need a hand. I have some MySQL queries for the joomla DB that maybe you could adapt.

If your webshost has cpanel and phpmyadmin it's a doddle - 5 mins and you'll be happy with it!

Gareth

gareth_w’s picture

and while I have successfully migrated two accounts by hand, it does not seem to work with the passwords

So plan b) - get your returning users to request a new one. This way you can also weed out those who do not revisit once registered!

Updating table users is OK but you need account creation dates in Drupal format and I've not figured this out yet - I think its unixy seonds since epoch but as I say I'm not sure. If this is important for your users you'll need to dig deeper.

You will also need to update the table user_roles.

As for extra info, no idea where this lives yet - I need to dig further.

But in practice, it is certainly do-able.

Gareth

gareth_w’s picture

and while it did not work for me, my test users can log in with their usernames and passwords.

The most likely explanation is that I have forgotten the password on that account and that it should have worked all along.

I will put an Excel spreadsheet together that generates these values, and try and post it here.

Gareth

gareth_w’s picture

It's pretty basic, but I *think* it does the job. I got the code from going into phpmyadmin, navigating to the table, inserting a row and copying the code it produced.

This is set up to add blank users (the explanation reflects this), but just dump your Joomla tables and copy the relevant data into the relevant columns here.

To use, you first need to enter the start user number in Cell A2. This is the number for the next available row in your users table. No idea what will happen if you leave gaps.

You need to enter your domain name in cell D2 for the email addresses to be created - or rewrite the formula in D6 to have a single email address for all accounts.

The password lives in cell C6. The password is never stored in the database, just a hash of it.

Finally, set the db name in table U2. You can get this fairly easily from phpmyadmin.

The SQL now lives in cells U6 and V6. There are two queries, one to set the user table and the next to set the user role - I believe 2 equates to authenticated user. If you need to build more fields on the profile, thats another query, but as that is custom to your site, it's beyond the scope here.

I'm struggling to upload the file to this site, but you should be able to grab it from here:

http://www.bkks.org.uk/downloads/drupal_user_db_SQL_generator.xls

Hope this at least points you in the right direction.

trumpcar’s picture

gareth_w,

Thanks for the inspiration! I made a few enhancements to your script and used it successfully. Here's a link to the article that describes it:

http://drupal.org/node/214022

Cheers,
Dev