Auth fields were not being re-fetched on every login as expected. Fixed.

This commit is contained in:
martinlanghoff
2005-06-07 23:19:45 +00:00
parent 530b8335f1
commit 6eabcba137
+5 -1
View File
@@ -2252,9 +2252,13 @@ function update_user_record($username) {
if (function_exists('auth_get_userinfo')) {
$username = trim(moodle_strtolower($username)); /// just in case check text case
$oldinfo = get_record('user', 'username', $username, '','','','', 'username, auth');
$authconfig = get_config('auth/' . $oldinfo->auth);
if ($newinfo = auth_get_userinfo($username)) {
foreach ($newinfo as $key => $value){
if (!empty($CFG->{'auth_user_' . $key. '_updatelocal'})) {
$confkey = 'field_updatelocal_' . $key;
if (!empty($authconfig->$confkey) && $authconfig->$confkey === 'onlogin') {
$value = addslashes(stripslashes($value)); // Just in case
set_field('user', $key, $value, 'username', $username);
}