You are here

function ldap_user_update_7206 in Lightweight Directory Access Protocol (LDAP) 7.2

Set an appropriate default value for accountsWithSameEmail.

File

ldap_user/ldap_user.install, line 526
Install, update and uninstall functions for the LDAP User module.

Code

function ldap_user_update_7206() {
  $message = NULL;
  $ldap_user_conf = ldap_user_conf('admin', TRUE);

  // If the configuration variable is not set, set a reasonable default and
  // advise the administrator.
  if (module_exists('sharedemail')) {
    $message = t('The module "sharedemail" was detected. LDAP User configuration has been set so that user accounts can be provisioned regardless of whether an existing user account has the same email address.');
    $ldap_user_conf->accountsWithSameEmail = LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_ENABLED;
  }
  else {

    // The "sharedemail" module is not enabled; do not enable this setting.
    // Do not mention anything in the hook_update_N output.
    $ldap_user_conf->accountsWithSameEmail = LDAP_USER_ACCOUNTS_WITH_SAME_EMAIL_DISABLED;
  }
  $ldap_user_conf
    ->save();
  return $message;
}