diff --git a/CHANGES.md b/CHANGES.md index 7253031f44cca0af6cf158895363626b00179e17..d76cecc6438e285c994b9cc7e7f644d714b7ff81 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Changes ### Unreleased +* 2020-12-11 - Adopt code changes from Moodle 3.10 core auth_ldap. * 2020-12-11 - Prepare compatibility for Moodle 3.10. * 2020-12-10 - Change in Moodle release support: For the time being, this plugin is maintained for the most recent LTS release of Moodle as well as the most recent major release of Moodle. diff --git a/auth.php b/auth.php index f89f001dc4df5e05238d29b64a76d1909f73c31c..7f5fe457615e3ab3a3478c208232741b10a853bf 100644 --- a/auth.php +++ b/auth.php @@ -118,7 +118,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap { do { if ($ldappagedresults) { - // TODO: Remove the old branch of code once PHP 7.3.0 becomes required (Moodle 4.1). + // TODO: Remove the old branch of code once PHP 7.3.0 becomes required (Moodle 3.11). if (version_compare(PHP_VERSION, '7.3.0', '<')) { // Before 7.3, use this function that was deprecated in PHP 7.4. ldap_control_paged_result($ldapconnection, $this->config->pagesize, true, $ldapcookie); @@ -131,7 +131,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap { } if ($this->config->search_sub) { // Use ldap_search to find first user from subtree. - // TODO: Remove the old branch of code once PHP 7.3.0 becomes required (Moodle 4.1). + // TODO: Remove the old branch of code once PHP 7.3.0 becomes required (Moodle 3.11). if (version_compare(PHP_VERSION, '7.3.0', '<')) { $ldapresult = ldap_search($ldapconnection, $context, $filter, array($this->config->user_attribute)); } else { @@ -140,7 +140,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap { } } else { // Search only in this context. - // TODO: Remove the old branch of code once PHP 7.3.0 becomes required (Moodle 4.1). + // TODO: Remove the old branch of code once PHP 7.3.0 becomes required (Moodle 3.11). if (version_compare(PHP_VERSION, '7.3.0', '<')) { $ldapresult = ldap_list($ldapconnection, $context, $filter, array($this->config->user_attribute)); } else { @@ -154,7 +154,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap { if ($ldappagedresults) { // Get next server cookie to know if we'll need to continue searching. $ldapcookie = ''; - // TODO: Remove the old branch of code once PHP 7.3.0 becomes required (Moodle 4.1). + // TODO: Remove the old branch of code once PHP 7.3.0 becomes required (Moodle 3.11). if (version_compare(PHP_VERSION, '7.3.0', '<')) { // Before 7.3, use this function that was deprecated in PHP 7.4. $pagedresp = ldap_control_paged_result_response($ldapconnection, $ldapresult, $ldapcookie); @@ -451,9 +451,7 @@ class auth_plugin_ldap_syncplus extends auth_plugin_ldap { // // The cast to int is a workaround for MDL-53959. $user->suspended = (int)$this->is_user_suspended($user); - if (empty($user->lang)) { - $user->lang = $CFG->lang; - } + if (empty($user->calendartype)) { $user->calendartype = $CFG->calendartype; } diff --git a/settings.php b/settings.php index 32e8e778b41fc38d3c8625ad82f30306fda0309c..7dff891f2067d3bf8993f841a2bf96b2075fde46 100644 --- a/settings.php +++ b/settings.php @@ -27,8 +27,9 @@ defined('MOODLE_INTERNAL') || die; if ($ADMIN->fulltree) { if (!function_exists('ldap_connect')) { - $settings->add(new admin_setting_heading('auth_ldap_syncplus_noextension', '', - get_string('auth_ldap_noextension', 'auth_ldap'))); + $notify = new \core\output\notification(get_string('auth_ldap_noextension', 'auth_ldap'), + \core\output\notification::NOTIFY_WARNING); + $settings->add(new admin_setting_heading('auth_ldap_noextension', '', $OUTPUT->render($notify))); } else { // We use a couple of custom admin settings since we need to massage the data before it is inserted into the DB.