From acd2b1dc865638ccea9ab130949112cbbcb8283f Mon Sep 17 00:00:00 2001
From: Alexander Bias <alexander.bias@uni-ulm.de>
Date: Mon, 25 Jun 2018 16:23:11 +0200
Subject: [PATCH] Bugfix: Creating users and first logins resulted in a fatal
 error in 3.5 because of a visibility change of update_user_record() in Moodle
 core.

---
 CHANGES.md       | 1 +
 eventhandler.php | 7 +++----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index ff28733..1789d57 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,6 +6,7 @@ Changes
 
 ### Unreleased
 
+* 2018-06-25 - Bugfix: Creating users and first logins resulted in a fatal error in 3.5 because of a visibility change of update_user_record() in Moodle core.
 * 2018-06-25 - Check compatibility for Moodle 3.5, no functionality change.
 
 ### v3.4-r4
diff --git a/eventhandler.php b/eventhandler.php
index e2fe1ec..97f5258 100644
--- a/eventhandler.php
+++ b/eventhandler.php
@@ -45,11 +45,10 @@ function update_user_onevent($eventdata) {
             // Do only if user has ldap_syncplus authentication.
             if (isset($user->auth) && $user->auth == 'ldap_syncplus') {
 
-                // Get LDAP Plugin.
-                $authplugin = get_auth_plugin('ldap_syncplus');
-
                 // Update user.
-                $authplugin->update_user_record($user->username);
+                // Actually, we would want to call auth_plugin_base::update_user_record()
+                // which is lighter, but this function is unfortunately protected since Moodle 3.5
+                update_user_record($user->username);
             }
         }
     }
-- 
GitLab