User fields not populating from AD

User fields not populating from AD

by Andrew Younkins -
Number of replies: 3

I have recently updated our Moodle environment to 3.2 and I am running into an issue where not all of the users information is populating into Moodle. When a new user signs in it populates only their last name. I made user all the fields were correct.

givenName

sn

mail

Anybody have any ideas where to start or how to fix?

Average of ratings: -
In reply to Andrew Younkins

Re: User fields not populating from AD

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You're not giving us much to go on. 

My usual plan with LDAP issues is to find an ldap search utility and run it on the server. Make sure you can definitely access all the records you think you should be able to. It's probably nothing to do with Moodle. 

In reply to Howard Miller

Re: User fields not populating from AD

by Andrew Younkins -

I know my LDAP is functioning properly because I have other services that are able to access those same fields without any problems. When I was running Moodle 3.1 users givenName, sn, and mail where all automatically populated and took them right to the dashboard. When I updated to Moodle 3.2 the only field that is being populated is sn.

I checked the Bind and it is correct. I checked the path and it is correct. Everything with my AD is correct, this only happened after I updated to Moodle 3.2.

In reply to Andrew Younkins

Re: User fields not populating from AD

by Ken Task -
Picture of Particularly helpful Moodlers

Got command line access to the 3.2 moodle?  IF so, there is a command line only php script in moodlecode/auth/ldap/cli/ called sync_users.php.

Make a backup of DB before using.

Comments in the header of that script for version 3.2.2:

 * Notes:
 *   - it is required to use the web server account when executing PHP CLI scripts
 *   - you need to change the "www-data" to match the apache user account
 *   - use "su" if "sudo" not available
 *   - If you have a large number of users, you may want to raise the memory limits
 *     by passing -d momory_limit=256M
 *   - For debugging & better logging, you are encouraged to use in the command line:
 *     -d log_errors=1 -d error_reporting=E_ALL -d display_errors=0 -d html_errors=0
 *   - If you have a large number of users, you may want to raise the memory limits
 *     by passing -d momory_limit=256M
 *   - For debugging & better logging, you are encouraged to use in the command line:
 *     -d log_errors=1 -d error_reporting=E_ALL -d display_errors=0 -d html_errors=0
 *

It takes settings from config of Moodle and as you can see, it has options for debugging and better logging.  They also warn that it could take a long time ... depending.

'spirit of sharing', Ken