Skip to content

Commit

Permalink
MDL-43415 auth_db: Adding custom profile fields to "Lock user fields"
Browse files Browse the repository at this point in the history
Adding custom profile fields to "Lock user fields". It's needed to sync
custom user profile fields with external DB.
  • Loading branch information
vadimonus authored and zbdd committed Feb 10, 2015
1 parent 88cd577 commit 4ad0d0f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion auth/db/auth.php
Expand Up @@ -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"};
}
Expand Down
2 changes: 1 addition & 1 deletion auth/db/config.html
Expand Up @@ -270,7 +270,7 @@ <h4><?php print_string('auth_sync_script', 'auth') ?> </h4>

<?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>

0 comments on commit 4ad0d0f

Please sign in to comment.