LDAP duplicates users

Re: LDAP duplicates users

by Emma Richardson -
Number of replies: 3
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Check your ldap settings.  It sounds as if the unique identifier is not set to samaccountname/username...if the account has been switched to ldap auth, then this will not happen if ldap is setup correctly.

In reply to Emma Richardson

Re: LDAP duplicates users

by Anze Pratnemer -

After some more pondering, friend of mine pointed out, that users should be created via users_create_user and not directly with DB query when importing them from 3rd party source.


Thus Moodle didnt realize that user was actually already existing (it is also stored somewhere else in DB I guess) and it created it properly again..

In reply to Anze Pratnemer

Re: LDAP duplicates users

by Anze Pratnemer -

Back on this problem again.


Altough I have imported users from 3rd party source with using user_create_user($data, false) core function, it started to happen again, users are getting duplicated on LDAP login.


Both users have identical data in their profiles.


I'm only using manual accounts and LDAP auth plugins. Only thing that changed from 25 of July when I posted my own solution was Moodle upgrade, but I dont see any changes in this regards from previous version..

In reply to Anze Pratnemer

Re: LDAP duplicates users

by Anze Pratnemer -

Again, had to waste few hours to finally found out, that somehow, with Moodle updates, mnethostid param of user table should be always set. Few months ago everything worked ignoring this value, now it seems its a must.


Had to set this value for all my users that were imported from 3rd party IS.