I am about to import about 10,000 users to my WordPress site from another CMS. Problem is, none of their passwords are going to work because they are not encrypted.
How do I encrypt all of these passwords quickly and in a way that WordPress will recognize and accept so that users can login?
As encryption and hashing are different stuff, I assume all these passwords are in plain text format. In this case, all you have to do is to apply the
md5
algorithm on them.You can do it from a SQL or a PHP importing script. Take a look at the Resetting Your Password Codex page, and that should give you some light.
Anyway, you won’t go too far from:
Take a look on the
get_userdata
function documentation to see what user info you can import at first moment.As it turns out, I found a couple of other ways to do this. One is done through your mysql phpmyadmin area (on the “sql” tab once you’ve selected the right database) and was posted by Andrew Vit on another thread within stackoverflow:
for the “where” condition, if all your passwords are the same length, you might use the following condition:
Of course, if your password length is different, simply change the “12” above to whatever the length of your passwords is. If they are NOT the same character length then you’ll have to use some other criteria for determining which passwords to encrypt (unless they ALL need to be encrypted, in which case you can leave the “where” condition off entirely.
I personally ended up using a php script to do the work, so that the passwords could be encrypted by WordPress itself (or at least using the method that WordPress uses). Here are the contents of my php file:
Done this way, not only are the passwords encrypted using WordPress’ own method, but, you also get a printout on your screen each time you run the script, showing you the ID of all the records that were updated and providing the corresponding hashed password.