Admin tools: Merge user accounts

tool_mergeusers
Maintained by Picture of Nicolas Dunand Nicolas Dunand, Picture of Jordi Pujol-Ahulló Jordi Pujol-Ahulló
This administration tool will merge two Moodle user accounts into one.
661 sites
436 downloads
38 fans

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.

Screenshots

Screenshot #0
Screenshot #1
Screenshot #2

Contributors

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
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Nicolas Dunand
    Wed, 2 Nov 2016, 12:38 AM
    Mehmet,

    This should in fact work but hasn't been tester with Moodle's own plugin installer. You should be able to install copying files to the file system without any issues though.
  • Picture of Mehmet Sen
    Wed, 2 Nov 2016, 2:50 AM
    Thanks Nicolas, copy pasting the folder worked out!
    Hopefully "Events 1 API deprecated... " warning would be corrected in next release as you indicated above.
    Thanks!
  • Picture of Jordi Pujol-Ahulló
    Thu, 3 Nov 2016, 11:39 PM
    Hi Adrian (https://moodle.org/user/view.php?id=1689996&course=1),

    Could you please check the conversation at https://github.com/ndunand/moodle-tool_mergeusers/issues/108 and say something with respect to your question?

    Thanks in advance!

    Jordi
  • Picture of David Cunningham
    Wed, 1 Feb 2017, 6:04 PM
    Hi

    I have recently tried installing this Plug in on Moodle 2.8 and once I have installed the plug in and try to run it, I receive the following error message, Exception thrown when merging: 'Error reading from database".
    Unknown column 'id' in 'field list'
    Trace:
    #0 /var/www/html/moodle/lib/dml/mysqli_native_moodle_database.php(1080): moodle_database->query_end(false)
    #1 /var/www/html/moodle/admin/tool/mergeusers/lib/table/generictablemerger.php(75): mysqli_native_moodle_database->get_records_sql('SELECT id FROM ...')
    #2 /var/www/html/moodle/admin/tool/mergeusers/lib/mergeusertool.php(288): GenericTableMerger->merge(Array, Array, Array)
    #3 /var/www/html/moodle/admin/tool/mergeusers/lib/mergeusertool.php(216): MergeUserTool->_merge('3110', '11041')
    #4 /var/www/html/moodle/admin/tool/mergeusers/index.php(135): MergeUserTool->merge('3110', '11041')
    #5 {main}

    Can anybody lend a helping hand if they have any idea on what the problem could be?
  • Picture of Jordi Pujol-Ahulló
    Wed, 1 Feb 2017, 7:32 PM
    Hi David,

    I think this is due to some local plugin you have installed that does not follow the Moodle standards, and some table from your database does not have a column named "id". Is that possible? The pity is that the error does not show which is the specific table that the process is dealing with.

    Could you check that?

    Regards,

    Jordi
  • Picture of Jose Galindo
    Wed, 19 Apr 2017, 1:20 AM
    First of all, congratulations on the great plugin,
    I had 2 doubts:
    1. How can I do so that the user origin data is not deleted?
    2. How can I choose which data I want to merge?
    A greeting and thanks in advance.
  • Picture of Jordi Pujol-Ahulló
    Thu, 20 Apr 2017, 2:34 PM
    Hi Jose!

    Thanks for your comments.

    An overall idea (with few exceptions):

    * What this plugin does is just replace the origin user id by the targer user id, so that is reflects as if all activity into Moodle was performed by the target user.
    * There are only few exceptions where this plugin deletes useless records. See de README.md from the plugin for more details.

    1. By now, only in certain cases records are deleted, and mainly only the user.id value is replaced by the target user.id. So that, actually, the records remain the same. I insist, with few exceptions.
    2. There is no possibility to choose wich data to merge, except user_preferences, user_private_key and user_info_data, which you can say (from plugin settings) that those records remain linked to every separated user.

    Hoping that helps on clarifying your doubts.

    Regards and thanks for asking!

    Jordi
  • Picture of Lai Wei
    Tue, 25 Apr 2017, 4:37 PM
    Just to let you know, the latest version of the plugin doesn't work with Moodle versions before 2.5 inclusive despite it declares it does. The issue is with the event triggering. Before 2.5 are triggered using events_trigger(), while after 2.6 it's replaced by $event->trigger(). I know 2.5 is aged but it may be better if the version information can be fixed.
  • Picture of Jordi Pujol-Ahulló
    Tue, 25 Apr 2017, 6:21 PM
    Hi!

    Thanks for the feedback!

    We will update it, as you suggested!

    Jordi
  • Picture of Petr Khl
    Sat, 2 Sep 2017, 3:16 PM
    Hello.
    Thank you for your plugin, it is really great but something went wrong in our case.
    We are testing it right now before applying to a real system and there is one problem we faced with. It is about forum grades.
    After merging two user accounts it has happend that the user does not have grades for any forum.
    When I started digging into the problem, it turned out that the grades have left in ratings table but not in grade_grades table?

    Can you please help me with this problem? May be I am doing something wrong?
    Serenely, Petr.
  • Picture of Petr Khl
    Sat, 2 Sep 2017, 3:18 PM
    Sorry, forgot to mention that we are using moodle 3.1 and have just moved from 1.9
  • Picture of Jordi Pujol-Ahulló
    Mon, 4 Sep 2017, 2:31 PM
    Hi!

    It may be possible, but this is the first time it was known for us. When you told us about the tables (grades and grade_grades or something like that), would you please explain a bit more about that? Which table was updated and which table was not?

    We dealt about grades on quiz attempts to be updated correspondingly, thanks to a contribution. Maybe this is a particular case to be updated too.

    Jordi
  • Picture of Simon Allison
    Sun, 10 Sep 2017, 5:15 PM
    I'm getting Fatal error: Class '\tool_mergeusers\event\user_merged_success' not found in E:\moodle\admin\tool\mergeusers\lib\mergeusertool.php on line 221

    Moodle 2.5.9 (Build: 20141110)
  • Picture of Jordi Pujol-Ahulló
    Tue, 12 Sep 2017, 2:18 PM
    Hi Simon!

    Thanks for the feedback. There is a point to consider on Moodle, that classes autoloading (https://docs.moodle.org/dev/Automatic_class_loading) is available only from Moodle 2.6 and on. If you are using the last version of this plugin, this will not work properly. Consider using an older version or using a newer Moodle version.

    Thanks for sharing.

    Jordi
  • Picture of Bruno Tavares
    Wed, 11 Oct 2017, 8:48 PM
    Greetings.

    On Moodle 2.6.11+ (build 20150619), either using v1.14.1 and v1.12 of the plugin, I'm getting the following error:

    Coding error detected, it must be fixed by a programmer: level must be specified in init() method of each method

    Debug info:
    Error code: codingerror
    Stack trace:
    line 427 of /lib/classes/event/base.php: coding_exception thrown
    line 489 of /lib/classes/event/base.php: call to core\event\base->validate_before_trigger()
    line 231 of /admin/tool/mergeusers/lib/mergeusertool.php: call to core\event\base->trigger()
    line 135 of /admin/tool/mergeusers/index.php: call to MergeUserTool->merge()

    What other information can I provide, to help getting to the problem's origin?

    Thanks in advance.

    Bruno Tavares
1 2 3 4 5 6 7
Please login to post comments