You are here

function ldapdata_user_update_profile in LDAP integration 5

Same name and namespace in other branches
  1. 5.2 ldapdata.module \ldapdata_user_update_profile()
1 call to ldapdata_user_update_profile()
ldapdata_user_update in ./ldapdata.module

File

./ldapdata.module, line 667

Code

function ldapdata_user_update_profile(&$edit, &$user) {
  $mapping_type = _ldapdata_ldap_info($user, 'mapping_type');
  if ($mapping_type != LDAP_MAP_ATTRIBUTES) {
    return array();
  }
  $ldap_drupal_reverse_mappings = _ldapdata_reverse_mappings($user->ldap_config);

  // Retrieve profile fields list
  $profile_fields = _ldapdata_retrieve_profile_fields();

  // Compare against $edit list
  $writeout = array();
  foreach ($profile_fields as $key => $field) {
    if (isset($edit[$field]) && isset($ldap_drupal_reverse_mappings[$key])) {
      $writeout[$ldap_drupal_reverse_mappings[$key]] = $edit[$field];
    }
  }
  return $writeout;
}