Merge User Account Script

3167

lanes_merge_road_sign_19531Please note that this is an advanced tool that will require access to your database (which you should backup first before executing any script)

Post Pages - Post Inline - WIRIS

Have a lot of users that have signed up with more than one email or were inadvertently added more than once to a site and now both have user data?  Have no fear, here’s a contributed script that you might be able to use to solve your duplicate user situation. Read more here https://moodle.org/plugins/view.php?plugin=report_mergeusers

The Merge User report/script “will merge two Moodle user accounts, “user A” and “user B”. The intent of the script is to assign all activity & records from user A to user B. This will give the effect of user B seeming to have done everything both users have ever done in Moodle.”

Check out the readme file for more important information and a few exceptions where the script doesn’t change anything (https://github.com/ndunand/moodle-mergeusers),

This script will merge two Moodle user accounts, “user A” and “user B”. The intent of the script is to assign all activity & records from user A to user B. This will give the effect of user B seeming to have done everything both users have ever done in Moodle. The basic function of the script is to loop through the tables and update the userid of every record from user A to user B. This works well for most tables.

So once complete, what was once two user accounts is now one account with all of the user data combined. Handy.

 

2 COMMENTS

  1. Thanks. I’m looking forward to the version that does a FULL merge, including the user files. Conidering the size of the discussions in the Moodle forums re this merge user profiles function you’d think that moodle.org would give this critical function a bit more priority…

  2. And doesn’t the fact that this version does not do a FULL merge leave junk in the database and Moodledata folder which could become a problem when you try to upgrade Moodle in the future?

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.