Merge user accounts

Administration tool ::: tool_mergeusers
Maintained by Jordi Pujol-Ahulló, Nicolas Dunand
This administration tool will merge two Moodle user accounts into one.
Latest release:
2652 sites
3k downloads
89 fans
Current versions available: 6

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 https://github.com/jpahullo/moodle-tool_mergeusers/issues/new 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.

Screenshots

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

Contributors

Jordi Pujol-Ahulló (Lead maintainer): author
Nicolas Dunand: author
Please login to view contributors details and/or to contact them

Comments RSS

Comments

  • Roberto Ortega
    Thu, 23 Dec 2021, 9:59 AM
    I'd like to use this tool to automate the merging of user accounts based on the idnumber field, which comes from LDAP. I am only starting to design how to accomplish this. We have about five merges to do every week due to people getting new user names in LDAP. I'd like to start the merge as soon as possible after the user logs in with their new account. I'm thinking to use a custom script to poll the database every minute for new users that have a duplicate idnumber and go ahead and process them with tool_mergeusers. It doesn't seem like the default gatherer will use command line parameters. Maybe a custom gatherer can take parameters from the command line. Alternatively, looks like I could create a custom gatherer to query for any users that need merging. Yet another idea is to create Moodle cron task that will find users and call the merge tool. Any suggestions for a robust approach?

    Also, how do I call the merge tool within PHP with the fromid and toid?
  • Jordi Pujol-Ahulló
    Thu, 23 Dec 2021, 4:52 PM
    Hi!

    I have in our institution a gatherer that deals with that identifier change nightly. It is a process that reads from an Oracle view and prepared the pair of users. To run it, we have a setting override in our config/config.local.php and put the cli/climerger.php into the server crontab. And it simply runs ok. Without cli parameters.

    Having a scheduled task would be very welcome and it would provide a nicer integration with Moodle.

    Fell free to create an issue https://github.com/ndunand/moodle-tool_mergeusers/ with all this and contribute, if possible.

    I can understand that the part of ldap gatherer may be so specific for your case, but if it can be made for general usecase, it would be very welcome. Scheduled task would be always very welcome.

    Thank you for your time.

    Jordi
  • Anisa Dewi
    Wed, 19 Oct 2022, 8:08 PM
    Hello,
    thank you for any contributions for this great plugin.
    I would like to know, did you plan a new release for Moodle 4.x and when will it be published?

    Best regards,
    Anisa
  • Jordi Pujol-Ahulló
    Wed, 16 Nov 2022, 8:14 PM
    Hi Anisa Dewi.

    Thanks for contacting.

    As I can see in the reports usage, this plugin is running on sites using Moodle 4. I know this plugin is not distributed for Moodle version 4, but if you upgrade and install it, it will run properly. If you find any issue, please contact us on https://github.com/ndunand/moodle-tool_mergeusers/.

    Thanks,

    Jordi
  • Peter Diedrichs
    Wed, 4 Jan 2023, 10:49 PM
    We would like to use this to merge staff accounts (we have 'external' accounts for extra staff, and if they gets employed they get a new, regular account).
    Is there anything that does not get copied when merging the accounts?
  • Picture of Greg in grey shirt smiling
    Thu, 16 Feb 2023, 10:28 PM
    Good day,
    We love this plugin! We are getting ready to move to version 4.X and our hosted provider is requiring all plugins to have a release version of 4.x to be installed on the server. I appreciate that the plugin appears to work in version 4, but would be very grateful if an official version 4 version was released. Many thanks.
    Greg
  • synnac w
    Wed, 5 Apr 2023, 11:04 AM
    What happens if both A and B have grading records in activities like quiz?
  • Jordi Pujol-Ahulló
    Thu, 6 Apr 2023, 12:05 AM
    Quiz attempts are gathered together on user B (to keep), and quiz is regraded.

    You can ask anything else on the github repo.

    Thanks,

    Jordi
  • Ronald Vyhmeister
    Thu, 7 Dec 2023, 8:20 AM
    Just upgraded from Moodle 3.9 to 4.1... just go to merge users (https://server/admin/tool/mergeusers/index.php) and I immediately get this error:

    error/invalidsqlsrvnativetype

    No further information is available... the rest of Moodle is running fine... The database is SQL server 2022 on Windows Server 2022... please advise
  • Ronald Vyhmeister
    Tue, 19 Dec 2023, 10:48 PM
    Found and resolved the problem...It's not in the mergeusers module, but in the ./lib/dml/sqlsrv_native_moodle_database.php file...

    For whatever reason type char is not defined, so you need to add it (currently on line 715) with the result looking like below... then it works fine. This appears to only be an issue for SQL Server...

    case 'CHAR':
    case 'VARCHAR':
    case 'NVARCHAR':
    $type = 'C';
    break;
  • Jordi Pujol-Ahulló
    Wed, 20 Dec 2023, 3:24 PM
    Thanks for the feedback Ronald.

    I suggest you to rise an issue on tracker.moodle.org, so that this is included into core. Provide as much detail as you can, and if possible, provide a patch to solve it. The last option will speed up the resolution.

    Thanks,

    Jordi
  • John Unnever
    Tue, 23 Jan 2024, 3:29 AM
    Having a weird issue where the radio buttons are not showing up next to the user accounts to be selected for merging. Any thoughts? No errors being produced in the logs or on screen. Debugging turned on. Merge users capability added to all authenticated users role.
  • Jordi Pujol-Ahulló
    Tue, 23 Jan 2024, 8:01 PM
    Hi John Unnever,

    Please, open an issue on github (as explained on this page in the yellow box), and report as much detail as you can, such as Moodle version, plugin version, and so, so that we have enough information to investigate.

    Off the top of my head, this is the first case of such an issue.

    Thanks for reporting.

    Jordi
  • Kristin Skarbøvik
    Tue, 13 Feb 2024, 9:06 PM
    Hi,
    We find this plugin very useful! smile
    Is this plugin compatible with Moodle Workplace and transfers data registered in the data store?

    Best regards,
    Kristin
  • Jordi Pujol-Ahulló
    Wed, 14 Feb 2024, 4:08 PM
    Hi Kristin,

    It is developed, tested and used on Moodle instances. We can do that because Moodle is open source.

    However, the cloud solution Moodle Workplace can be only used through a Moodle Partner and it is not open sourced. Never thoght about it, but, yes, we would like to have this plugin also supporting Moodle Workplace. So I propose you to ask your Moodle Partner to test it and prepare any Pull Requests on the github repo referenced on this page, with the necessary changes to work with Moodle Workplace. I imagine that we could keep a version for Moodle Workplace.

    Thanks.

    Jordi
Please login to post comments