This functionality will allow you to merge multiple user accounts into the one. This allows you to consolidate the records from duplicated users. Please note this is a Moodle plugin and does not come standard with core Moodle.
This instruction has been written in Learnbook running Moodle version 3.0
There are two parts to this instruction.
A - setup the global merge user settings
B - perform the merge
Part A - Global Settings
Step 1. From the “Administration” tab in the left hand menu bar select “Site Administration”
Step 2. Expand “Plugins”
Step 3. Expand “Admin Tools”
Step 4. Click on “Merge user accounts”
Step 5. Global Details
Suspend old user - If enabled, it suspends the old user automatically upon a successful merging process, preventing the user from logging in Moodle (recommended). If disabled, the old user remains active. In both cases, old user will not have his/her related data.
Only transactions allowed - If enabled, merge users will not work at all on databases that do NOT support transactions (recommended). Enabling it is necessary to ensure that your database remains consistent in case of merging errors.
If disabled, you will always run merging actions. In case of errors, the merging log will show you what was the problem. Reporting it to the plugin supporters will give you a solution in short.
Above all, core Moodle tables and some third party plugins are already considered by this plugin. If you do not have any third party plugins in your Moodle installation, you can be quiet on running this plugin enabling or disabling this option.
Excluded exceptions - Unless you have very specific requirements and are an experienced user then this should be left set as none. The details behind this option however are: Experience on this subject suggests that all these database tables should be excluded from merging. See README for more details.
Therefore, for applying default plugin behaviour, you need to choose 'None' to exclude all those tables from the merging process (recommended).
If you prefer, you can exclude any of those tables and include them in the merging process (not recommended).
How to resolve quiz attempts -
When merging quiz attempts there may exist three cases:
- Only the old user has quiz attempts. All attempts will appear as if they were made by the new user.
- Only the new user has quiz attempts. All is correct and nothing is done.
- Both users have attempts for the same quiz. You have to choose what to do in this case of conflict. . You are required to choose one of the following actions:
- Merge attempts from both users and renumber. Attempts from the old user are merged with the ones of the new user and renumbered by the time they were started.
- Keep attempts from the new user. Attempts from the old user are removed. Attempts from the new user are kept, since this option considers them as the most important.
- Keep attempts from the old user. Attempts from the new user are removed. Attempts from the old user are kept, since this option considers them as the most important.
- Do nothing: do not merge nor delete (by default). Attempts are not merged nor deleted, remaining related to the user who made them. This is the most secure action, but merging users from user A to user B or B to A may produce different quiz grades.
Keep new user’s data - In case of conflict, like when the user.id related column is a unique key, this plugin will keep data from new user (by default). This also means that data from old user is deleted to keep the consistency. Otherwise, if you uncheck this option, data from old user will be kept.
Step 6. Once the desired settings have been selected click the “Save Changes” button.
Part B - Perform the Merge
Given a user to be deleted and a user to keep, this will merge the user data associated with the former user into the latter user. Note that both users must already exist and no accounts will actually be deleted. That process is left to the administrator to do manually.
Only do this if you know what you are doing as it is not reversible!
Step 1: From the “Administration” tab in the left hand menu bar select “Site Administration”
Step 2: Expand “Users”
Step 3: Expand “Accounts”
Step 4: Expand “Merge user accounts”
Step 5: Click “Merge user accounts”
Step 6: The below screen shows what the “Merge user accounts” area looks like.
There are a few ways in which to locate users for merging but the easiest is to know the username of both users to be merged.
Step 7: In the “search for user” text field select “All” from the dropdown.
Step 8: Click “Show more”
Step 9: Enter the username of the user to be removed and the username of the user to be kept.
Step 10. Click “Search”
Step 11. Click “Save Selection”
Step 12. Click “Merge user accounts”
Step 13. Select “Yes” on the confirmation screen.
The below shows the merge report which is published upon successful completion.
Step 14. Click “Continue” to complete the process.