Admin tools: Merge user accounts

Maintained by Picture of Nicolas DunandNicolas Dunand, Picture of Jordi Pujol-AhullóJordi Pujol-Ahulló
This administration tool will merge two Moodle user accounts into one.
1084 sites
47 fans
Current versions available: 3

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.


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


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

Comments RSS

Show comments
  • Picture of Jordi Pujol-Ahulló
    Wed, Jul 4, 2018, 12:11 AM
    Hi Zackary!

    Thanks for reporting.

    It is very very weird that this plugin tries to look for a table that actually does not exist. Most of all because it looks for all tables in runtime and then iterates for all of them.

    However, if this is the case (we should take a look why it is happenning), you can take a turnaround and let the plugin prevent processing that table. Let's see:

    Taking a look at what we talk about here: we can add ad-hoc configuration for every Moodle instance independently.

    I recommend you to place the file "admin/tool/mergeusers/config/config.local.php" with the following content:

    ========================= <?php

    return array(
    'exceptions' => array(
    'ast_access1095', //don't place the table prefix on the table name

    If you have this file already created, for whatever reason, you should have to merge the content. Otherwise, you just create the file with the above content.

    Just tell us what it's going on!


  • Picture of Jordi Pujol-Ahulló
    Wed, Jul 4, 2018, 12:12 AM
    Sorry, the content should be this (without the "=" strings):



    return array(
    'exceptions' => array(
    'ast_access1095', //don't place the table prefix on the table name


    Hope that helps!
  • Picture of Zackary Bennett
    Sat, Jul 7, 2018, 12:33 AM
    Thank you Jordi! Adding that exception did the trick. So simple and effective.
  • Picture of Evan Abbey
    Thu, Jul 12, 2018, 11:35 PM
    Jordi, we have used the merge users plugin for a while (since it was a report). We just noticed that it is not merging grades within a gradebook when both of the student accounts were enrolled. We are on Moodle version 3.5.0. There are no errors or anything within debugging to indicate that something is wrong that I can see.

    • Is this the intended outcome? I might have missed that the plugin always did this in the past, and just thought it was merging them. I attempted to rollback the plugin, and that made no difference.

    • Right now, our log output for a merge shows these two lines related to grades:
    DELETE FROM mdl_grade_grades WHERE id IN (38548, 38547, 38549)
    UPDATE mdl_grade_grades_history SET userid = '9232' WHERE id IN (137943, 137944, 137945, 137946)

    Do I have a setting incorrect? I have been leaving the default settings for the plugin, as they have worked for me in the past.

    Thank you
  • Picture of Jordi Pujol-Ahulló
    Wed, Jul 18, 2018, 12:32 AM
    Thanks @Zackary for the feedback. We are happy to make it work as a charm.
  • Picture of Jordi Pujol-Ahulló
    Wed, Jul 18, 2018, 12:39 AM
    Hi @Evan!

    Thanks for giving us feedback.

    Please, check if this issue is related to your case:

    If so, add there your comments to get them there and be complementary to what already exists. Otherwise, in case of doubt, make a new issue with your text.

    Depending on what matches best, it may be an underlying bug long time existing or it may be a new issue for working it on Moodle 3.5. Your information there would be necessary to match the case. Put that information, please, on github.

    Thank you for sharing,

  • Picture of Evan Abbey
    Wed, Jul 18, 2018, 12:41 AM
    Will do, thx Jordi
  • Picture of Trish Evans
    Mon, Aug 13, 2018, 8:41 AM
    I used your tool to try to combine two accounts. It appears to have worked however when the user attempted to run a grade report it gave the following error :

    Debug info:
    Error code: nopermissions

    Stack trace:
    line 808 of /lib/accesslib.php: required_capability_exception thrown
    line 65 of /grade/report/grader/index.php: call to require_capability()

    The role for this user in this course hasn't changed and is ARCHETYPE: Teacher (editing).

    Any input would be appreciated.
  • Picture of Trish Evans
    Mon, Aug 13, 2018, 8:47 AM
    Re above query - we are on Moodle version 3.4.3
  • Picture of Jordi Pujol-Ahulló
    Tue, Aug 14, 2018, 12:59 AM

    Thanks for reporting.

    This sound very strange. This is something totally new.

    There should not be any problem about merging two accounts, if both are teacher (editing teacher).

    I would like to give you more feedback, but we need more detail on this.

    I propose you to start a new issue in our Github project:, so that we keep a single discussion, without mixups, on this issue. Please, on the new issue at github, report the above information and the log (as much as possible) for the merged users (as a text file or so -copy&paste- big grin ).

    Thank you so much for your time Trish!


    Do you think
  • Picture of Rob Mills
    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.
  • Picture of East Riding College eLearning
    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.


  • Picture of Manabu Abe
    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.
  • Picture of Manabu Abe
    Thu, Jun 27, 2019, 9:47 AM
    Sorry, ignore my previous post as I just realized I used an older version.
  • Picture of Nicolas Dunand
    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.
1 2 3 4 5 6 7 8
Please login to post comments