I followed the instructions in the example module and this thread (http://drupal.org/node/1181136) to import users in a new D7 site from an old D5 site. The importing of users works well, but the passwords don't work. Passwords get generated, but they're not the same (that is, user cannot login).

I also tried the instructions on this page: http://stackoverflow.com/questions/6205605/drupal-6-user-password-import... to rehash the password, with no success.

Comments

moshe weitzman’s picture

Status: Active » Postponed (maintainer needs more info)

please show us your field mapping for password field.

pmusaraj’s picture

Sure thing. Here's my code, in its entirety:

class D5UserMigration extends UsersExampleMigration {
  public function __construct() {
    parent::__construct();
    $this->description = t('Users from old D5 site');
    $this->map = new MigrateSQLMap($this->machineName,
        array('uid' => array(
                'type' => 'int',
                'not null' => TRUE,
                'description' => 'User ID.'
                )
             ),
        MigrateDestinationUser::getKeySchema()
    );
    $query = db_select('usersd5', 'udf')
             ->fields('udf', array('uid', 'name', 'pass','mail','created','access','login','status','language','init'));
    $this->source = new MigrateSourceSQL($query);
    $this->destination = new MigrateDestinationUser(array('md5_passwords' => TRUE));

    $this->addSimpleMappings(array('status', 'mail','created','access','language', 'login','init'));
    $this->addFieldMapping('name', 'name');

    $this->addFieldMapping('pass', 'pass');

    $this->addFieldMapping('roles')
         ->defaultValue(2);

    $this->addUnmigratedDestinations(array('theme', 'signature','timezone', 'picture','signature_format','field_migrate_example_gender','path'));

  }
}
pmusaraj’s picture

Status: Postponed (maintainer needs more info) » Active

Changed status since the requested field mapping was posted.

mikeryan’s picture

Category: support » bug

Looks like you have it set up right, the D7 user destination is supposed to do the proper rehashing when you set the md5_passwords option. We need to investigate...

mikeryan’s picture

Status: Active » Fixed

I notice belatedly that this issue has Version 7.x-2.1 - the md5_passwords feature was added after 2.1 was released, please upgrade to the latest RC of 2.2 (or the final 2.2, if I release that before you have a chance to try the RC).

parallax’s picture

Upgrading to RC 2.2 solved the problem. Thanks Mike!

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Clarification