diff --git a/auth/db/auth.php b/auth/db/auth.php index 3feed3edfb63e..fe3ebeccf0e5e 100644 --- a/auth/db/auth.php +++ b/auth/db/auth.php @@ -168,7 +168,15 @@ function db_init() { */ function db_attributes() { $moodleattributes = array(); - foreach ($this->userfields as $field) { + // If we have custom fields then merge them with user fields. + $customfields = $this->get_custom_user_profile_fields(); + if (!empty($customfields) && !empty($this->userfields)) { + $userfields = array_merge($this->userfields, $customfields); + } else { + $userfields = $this->userfields; + } + + foreach ($userfields as $field) { if (!empty($this->config->{"field_map_$field"})) { $moodleattributes[$field] = $this->config->{"field_map_$field"}; } diff --git a/auth/db/config.html b/auth/db/config.html index 331ad04127a96..8d04d04444bbf 100644 --- a/auth/db/config.html +++ b/auth/db/config.html @@ -270,7 +270,7 @@

authtype, $user_fields, get_string('auth_dbextrafields', 'auth_db'), true, true); +print_auth_lock_options($this->authtype, $user_fields, get_string('auth_dbextrafields', 'auth_db'), true, true, $this->get_custom_user_profile_fields()); ?>