LDAP Sync + Custom Profile Fields

LDAP Sync + Custom Profile Fields

by Ellio Mourinho -
Number of replies: 8

We've got LDAP set up for authentication for a script that runs on a hourly basis to pull in updated info for users. However when the cronjob triggers it, we get these messages in the error log:

Updating user unset1202725 id 4875PHP Notice: Undefined property: stdClass::$profile_field_collegecode in /var/www/auth/ldap/auth.php on line 1044

PHP Notice: Undefined property: stdClass::$profile_field_degree in /var/www/auth/ldap/auth.php on line 1044
PHP Notice: Undefined property: stdClass::$profile_field_faculty in /var/www/auth/ldap/auth.php on line 1044
PHP Notice: Undefined property: stdClass::$profile_field_majorcode in /var/www/auth/ldap/auth.php on line 1044

I found this topic regarding it: https://moodle.org/mod/forum/discuss.php?d=253169 however it was only mentioned that using upper/mixed case caused issues, this is not the case with our field names as you can see.

Any idea how to fix? I've put in an *incredibly* hacky fix in the meantime, but it doesn't resolve the issue that it always detects it as needing an update.

Average of ratings: -
In reply to Ellio Mourinho

Re: LDAP Sync + Custom Profile Fields

by Florent Lartet -

Hello,

same behaviour with 2.9.1 at this time.

The sync script doesn't update these fields with the Notice you have.

When put on "Update on login", it works only on login.

I'll study the problem closer.

In reply to Florent Lartet

Re: LDAP Sync + Custom Profile Fields

by heli g -

I had the same problem with 2.6 and now, after upgrade, with 2.9. Did you find a solution?

In reply to heli g

Re: LDAP Sync + Custom Profile Fields

by Florent Lartet -

No, but luckily my custom field was related to the people's login. The field is properly updated at every user login, it was enough for me.

I had looked a bit into the code and the problem was not obvious, and I didn't have to make it work ...

In reply to Florent Lartet

Re: LDAP Sync + Custom Profile Fields

by heli g -

Thanks for the reply. My field is also being populated on login.

What I am uncertain about is if this means that the syncing script is failing to add new users in addition to failing to update since I created the custom field. The reason I use the script is so that external database enrolment will work whether or not a Student or Teacher has logged in...

If it is failing altogether, I might as well stop ldap sync as I see it is very resource intensive and runs for over 30 mins...

In reply to heli g

Re: LDAP Sync + Custom Profile Fields

by Kevin Wiliarty -

On a test server I see that a new user is added despite the PHP notices on sync. I can't guarantee the same is happening for you, but it probably is. A notice like that shouldn't crash the rest of the process, but you should test. My test server is running the as yet unreleased version 3.0, but the problem is still there: custom profile fields are not being handled correctly in the sync script. There's a tracker item you might want to vote for:

https://tracker.moodle.org/browse/MDL-40613

In reply to Kevin Wiliarty

Re: LDAP Sync + Custom Profile Fields

by Florent Lartet -

Same for me, and you can read it in the log file, there is a notice only at the custom field retrieval that doesn't exist. Despite of that, everything is going right.

In reply to Florent Lartet

Re: LDAP Sync + Custom Profile Fields

by heli g -

With the new year I've finally had a chance to observe in production - and you are right: despite the error for the custom profile field - new users are being created and profiles are updated.