function _ldap_profile_add_change in Lightweight Directory Access Protocol (LDAP) 7
Helper method to check whether or not we should add the text to our changes array
Parameters
$account The user's account object:
$field The field for which we want to set/update:
$change String containing the value we want to: change to (if nothing has changed)
Return value
Boolean - True if we should add this change, false otherwise
1 call to _ldap_profile_add_change()
- ldap_profile_user_login in ldap_profile/
ldap_profile.module - Implements hook_user_login().
File
- ldap_profile/
ldap_profile.module, line 320 - This module provides the LDAP package the ability populate drupal profile fields with ldap entry data such as last name, first name, etc.
Code
function _ldap_profile_add_change($account, $field, $change) {
$add = FALSE;
if (!property_exists($account, $field)) {
$add = TRUE;
}
else {
$f = $account->{$field};
if (array_key_exists("und", $f)) {
if (array_key_exists("0", $f["und"])) {
if (array_key_exists("value", $f["und"][0])) {
if ($f["und"][0]["value"] != $change) {
$add = TRUE;
}
elseif (empty($f)) {
$add = TRUE;
}
}
}
}
elseif (is_array($f)) {
if (count($f) == 0) {
$add = TRUE;
}
}
}
return $add;
}