Users and Merging two Moodles

Users and Merging two Moodles

by Jeremy Schweitzer -
Number of replies: 3
Picture of Plugin developers Picture of Testers

My team has been tasked with merging a smaller, independent Moodle installation into a larger Moodle instance. The two sites have run for several years. To make our lives easier, we are attempting to migrate the smaller site (fewer courses and a lot fewer users) into the larger site. Both sites are currently running Moodle 2.7.9+. 

We actually have most of the migration working fine, but one of the requests is giving us fits. As part of the migration they don't want to force anyone to change their passwords, so we are trying to migrate those as well, but having trouble. 

The accounts and courses all get transferred successfully, but the transferred users have to reset their password in order to login. We don't mind transferring the users directly in the database (in fact that has worked best so far), but there must be something that we're missing.

Thoughts or ideas? 

Average of ratings: -
In reply to Jeremy Schweitzer

Re: Users and Merging two Moodles

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Firstly, you need to make sure that the 'target' site has both password salts from each site in config.php (Moodle works through the list to find one that works). 

This is where an external authentication source (e.g. LDAP) would have made your life easier. To be honest, I don't know if backup/restore with user data attempts to transfer the passwords (in encrypted form, of course) but I would not be at all surprised if it doesn't. With the caveat of the salts above you should be ok transferring the encrypted passwords between databases 'manually' but I'd want to try it to be 100% sure. 

In reply to Howard Miller

Re: Users and Merging two Moodles

by Jeremy Schweitzer -
Picture of Plugin developers Picture of Testers

Howard,

Thanks for the response. I'm not sure the salts are necessary since the change in password encryption in Moodle 2.5, but we have placed them in the config file just in case one of our users hasn't changed their password since the upgrade.

We have moved the mdl_users table over to the new site and that allows the user to change their password and everything seems to work then, but it doesn't seem to support them logging in without first going through the password reset process first. Got any ideas why the transferred passwords aren't working? 

In reply to Jeremy Schweitzer

Re: Users and Merging two Moodles

by Jeremy Schweitzer -
Picture of Plugin developers Picture of Testers

As a quick update - I think that I've figured out the problem. The mnethostid was different between the two sites, once I changed the imported user's accounts to match the target site's mnethostid they appear to let the old passwords work. 

We have a little more testing to do, but I think we've got it figured out. 

I also can't confirm this, but it looks like either most users have changed their password at least once since we upgraded to Moodle 2.7, or the upgrade itself reprocesses the passwords because the site salt doesn't appear to have any effect, so we plan to omit it completely.