MDL-43415 auth_db: Adding custom profile fields to "Lock user fields"

Adding custom profile fields to "Lock user fields". It's needed to sync
custom user profile fields with external DB.
This commit is contained in:
Vadim Dvorovenko 2015-01-15 00:44:37 +07:00 committed by Zachary Durber
parent 88cd577ef3
commit 4ad0d0f2f5
2 changed files with 10 additions and 2 deletions

View file

@ -168,7 +168,15 @@ class auth_plugin_db extends auth_plugin_base {
*/
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"};
}

View file

@ -270,7 +270,7 @@
<?php
print_auth_lock_options($this->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());
?>
</table>