You are here

function ldap_user_form_register_form_submit2 in Lightweight Directory Access Protocol (LDAP) 8.2

Same name and namespace in other branches
  1. 8.4 ldap_user/ldap_user.module \ldap_user_form_register_form_submit2()
  2. 8.3 ldap_user/ldap_user.module \ldap_user_form_register_form_submit2()
  3. 7.2 ldap_user/ldap_user.module \ldap_user_form_register_form_submit2()

called after user_register_form_submit *

1 string reference to 'ldap_user_form_register_form_submit2'
ldap_user_form_user_register_form_alter in ldap_user/ldap_user.module
Implements hook_form_FORM_ID_alter(). for user_register_form

File

ldap_user/ldap_user.module, line 599
Module for the LDAP User Entity

Code

function ldap_user_form_register_form_submit2($form, &$form_state) {
  $values = $form_state['values'];
  $ldap_user_association_set = FALSE;
  if (@$values['ldap_user_create_ldap_acct']) {
    if ($account = user_load_by_name($values['name'])) {
      $ldap_user_conf = ldap_user_conf();
      $ldap_provision_entry = $ldap_user_conf
        ->getProvisionRelatedLdapEntry($account);
      if (!$ldap_provision_entry) {
        $provision_result = $ldap_user_conf
          ->provisionLdapEntry($account);
      }
      else {
        $ldap_user_association_set = TRUE;
      }
    }
    else {

      // don't do anything here.  If account is not created, other user module warnings will exist
    }
  }
  if ($ldap_user_association_set || @$values['ldap_user_association'] == LDAP_USER_MANUAL_ACCT_CONFLICT_LDAP_ASSOCIATE) {
    $ldap_user_conf = ldap_user_conf();
    $ldap_user_conf
      ->ldapAssociateDrupalAccount($form_state['values']['name']);
  }
}