I don't really need to import any data into my D7 build other than users. I have (by SQL) imported my user data however, the D7 password encryption method is now different.
I'm not an expert by any stretch of the imagination and I've never used Drush, but I have come across this user_update_7000 code snippet found user.install (http://api.drupal.org/api/drupal/modules--user--user.install/function/user_update_7000/7)
<?php
require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc');
$old_hash = md5('password');
$hash_count_log2 = 11;
$new_hash = user_hash_password($old_hash, $hash_count_log2);
if ($new_hash) {
// Indicate an updated password.
$new_hash = 'U' . $new_hash;
}
?>
Where could I run this script in order to update the password field in my DB?
Thanks,
Steve
This answer was perfect. I used it to update from a Drupal 5 site. I made a couple of changes to suit my purposes:
I didn't limit the number of passwords that get updated. I wanted all of them updated, and the system I was updating had many more than 1,000 users.
I added a check to make sure I wasn't updating a password twice. This way, if it times out (as it did for me) modifying all the passwords, I can rerun the rehash.php to complete the conversion. Be aware, though, that once a user logs in, the leading "U" is removed when the password is re-hashed.
I don't have enough points to add a comment, but I've made several refinements to hross' answer (and submitted a draft update).
Here's an improved script with documentation and the ability to specify a non-default users table for those doing manual Drupal 6 to 7 merges. It also incorporates jpb's checking.
I think you can create a page named something like rehash.php (in your root, same place as update.php). Then, log in as administrator first, browse to this page second. See code below (most taken from user_update_7200 in the latest drupal 7 install)...
Worse case, you could create a simple custom module and put this code in there.
Please note that you should back things up first: