Merge user accounts

Admin tools ::: tool_mergeusers
Maintained by Nicolas Dunand, Jordi Pujol-Ahulló
This administration tool will merge two Moodle user accounts into one.
Latest release:
1865 sites
67 fans
Current versions available: 4

The intent 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.

This tool replaces the old report_mergeusers, which is now obsolete.

Help us

We do not give support in the comments section below. For any issue on the plugin, please, refer to GitHub and:

  1. Check if a related issue is already created with the exact detail or similar to the failure you're facing. Add your own experience too. Or
  2. Build a new issue clicking on and add the necessary detail to replay the failure or the trace to help you out, and/or
  3. Contribute to the plugin with a PR addressing the problem you're solving.

Help us manage this plugin in a more comfortable way in our spare time by using GitHub. Thanks in advance!

Potential privacy issues

This plugin does not store any personal data.


Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3


Nicolas Dunand (Lead maintainer): author
Jordi Pujol-Ahulló: author
Forrest Gaston: contributor
Mike Holzer
Mike Holzer: contributor
RISET Université de Lausanne: Supporting institution
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Thu, Apr 25, 2019, 1:04 AM
    I am using 3.6.2. Can this plugin be expected to work? I can't install it directly from here - won't allow me. I would have to download and install manually.
  • Wed, May 29, 2019, 6:36 PM

    Apologies if this has been asked before but is there any danger in deleting the account that becomes hidden once the merge has taken place? I'm thinking any assignments that a teacher has set up being deleted and things of that nature.


  • Wed, Jun 26, 2019, 10:48 AM
    Hi there,
    I love the concept of the plugin and wanted to start using it.
    Today, I tried it and it said Unsupported database type: {$a}. Do you have any idea how I can fix it? When I tested it with MariaDB (10.3.15), it said not supported.

    We are using MySQL 5.7.26 and Moodle 3.5.3.
  • Thu, Jun 27, 2019, 9:47 AM
    Sorry, ignore my previous post as I just realized I used an older version.
  • Thu, Jun 27, 2019, 12:59 PM
    Hi Manabu,
    Thanks for reporting back and clarifying. I'm glad updating to the newest version solved your problem.
  • Health & Safety Training Ninja
    Fri, Jul 19, 2019, 9:55 PM
    Issues: There is some useful profile data which is not transferred to the user to keep after merge. Mainly to do with login records.

    I noticed when merging user accounts the details in the user profile field for "firstaccess" and "lastaccess" go un-populated once the accounts have been merged. This is despite the user to remove having details populated for these fields. Checking in the database, it's actually all the following fields do not pull over the data from the user to remove profile: "firstaccess", "lastaccess", "currentlogin", "lastip". I feel these are very important fields to fully merge into the updated profile and gives quick access when viewing profiles.

    I release these fields maybe populated on both accounts, therefore in this case the merge should take the earliest "firstaccess" date, the last "lastaccess" date and the last "currentlogin". For whichever profile has the currentlogin closest to the current date, the "lastip" should be taken from which ever profile that was - all this data can then be merged to the "user to keep" profile, without necessarily deleting it from the old (now suspended user to remove).

    I hope you take on the above suggestion as it solves a few issues from an Admin perspective; it would certainly help me out at present.

    Aside from the above, there's also user preferences to merge, but I can understand why this has not been incorporated to the merge plugin.

  • Wed, Jul 24, 2019, 10:49 PM
    Hello. Let me start by congratulating your work on this excellent plugin.
    I have one problem, I have an installation of Moodle on a Oracle 11gR2 database.
    I read a lot from the plugin but I did not see that Oracle wasn't supported. Only non transactional databases. Oracle is transactional.
    But after installing the plugin when I try to access it I get an error "Error: Database type oci not supported.".

    So my question is, will this function in Oracle or not? Thank you.
  • Thu, Jul 25, 2019, 2:58 PM
    Thanks for the kind words.
    Actually, this plugin works with any database, accepting transactions or not. The important thing is that de database allowing transactions in order to prevent applying changes partially in case of any error.
    You, as administrator, can prevent from working if the current database does not accepts transactions.
    Regarding Oracle, it should work, since Moodle works with Oracle. Maybe we have any considerations or restrictions in the plugin code for some reason (I don't remember right now). Please, open an issue on the github repo to tell us this problem.
    Thanks a lot for reporting!
  • Thu, Jul 25, 2019, 3:38 PM
    Hi Helder,

    Thanks for your feedback and for reporting this issue. As Jordi stated, transactional support is not mandatory – and anyway Oracle supports it.

    The error "Error: Database type oci not supported." comes from the fact that we check for each database type explicitly in the code, but we don't check against 'oci' (Oracle). I've opened a GitHub issue with the relevant code section to be changed:
    I however don't have any Oracle database at hand to try it out. Could you try the SELECT query I mention in the GitHub issue?
  • Thu, Jul 25, 2019, 5:31 PM
    Hi Nicolas. Our interaction on github solves the problem.
    I will now try some test cases.
    Thank you a lot!
  • Thu, Aug 15, 2019, 6:36 PM
    thanks for this information
  • Tue, Aug 20, 2019, 4:54 PM
    Hi! Problems on Oracle support and other issues are addressed with the latest release of this plugin. Consider upgrading to benefit its improvements.
  • Tue, Aug 20, 2019, 5:25 PM
    Now on, we'll only give support via GitHub. Thanks for help us maintaining this plugin in our spare time.
    Thanks a lot for all your feedback.
  • Fri, Jul 10, 2020, 9:52 AM
    Hi, I am attempting to install this on our test site. Version 3.5.4 and I get this message;
    Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; date_iterator has a deprecated constructor in /home/ on line 1858

    Is it because of the code in the plugin, or something in our Moodle.

    Thank you
  • Fri, May 28, 2021, 5:54 PM
    Hi, I am attempting to merge to user accounts but receive the error below. May I know if you have any idea to resolve this issue?

    For further reference, these results are recorded in the log id 5.
    Some error occurred:

    Exception thrown when merging: 'Can not find scorm activity with id 382".

    #0 /opt/bitnami/apps/moodle/htdocs/admin/tool/mergeusers/lib/mergeusertool.php(271): MergeUserTool->updateGrades('94168', '2893')
    #1 /opt/bitnami/apps/moodle/htdocs/admin/tool/mergeusers/lib/mergeusertool.php(192): MergeUserTool->_merge('94168', '2893')
    #2 /opt/bitnami/apps/moodle/htdocs/admin/tool/mergeusers/index.php(135): MergeUserTool->merge('94168', '2893')
    #3 {main}

    Started merging at Friday, 28 May 2021, 2:50 PM
    Merge took 406 seconds
1 2 3 4 5 6 7 8 9
Please login to post comments