Wednesday, April 4, 2012

Mirgrating user accounts from moodle instances

I have about 25 teachers in my moodle 1.9 instance that I need in my moodle 2.2 instance. I did not want to recreate the accounts and have to type in account details. After a bit of analysis and consideration of the obvious choice was:
  • - create a select statement that choose the fields and records to move from the 1.9 instance
  • - save the results of the select statement to a CSV file.
  • - Import the CSV file in the moodle 2.2 instance
I used MySQL Workbench to create the select statement and save the result to a CSV file. I used phpMyAdmin to Import the file. The first time I tried importing the file, it failed. The second time, I copied the first row (column names) from the CSV file and pasted them into the col. headers text field on the Import GUI, and it worked fine.

After importing the records, I had to update them so moodle would recognize them. I noticed after importing them, the records did not show up in the enrollment list. I had to run a simple update query setting the confirmed field to 1.

After importing the user records, set the confirmed field to 1.

Moral of the story?

Even thought it was a little work for 25 records, it was still better than recreating the records manually.

No comments:

Post a Comment