You are here

function ldapauth_user_to_local_user in LDAP integration 6

Page callback function to convert a user from an LDAP authenticated user to a normal drupal user.

Parameters

unknown_type $account:

1 string reference to 'ldapauth_user_to_local_user'
ldapauth_menu in ./ldapauth.module
Implements hook_menu().

File

./ldapauth.admin.inc, line 836
Module admin page callbacks.

Code

function ldapauth_user_to_local_user($account) {
  if ($account->ldap_authentified) {
    $data = array(
      'ldap_dn' => NULL,
      'ldap_config' => NULL,
      'ldap_name' => NULL,
      'ldap_authentified' => NULL,
    );

    // Give other modules a chance to do removal housekeeping.
    drupal_alter('ldap_convert_to_local', $data, $account);
    $userinfo = ldapauth_userinfo_load_by_uid($account->uid);
    ldapauth_userinfo_delete($userinfo);
    db_query("DELETE FROM {authmap} WHERE uid = %d AND module = 'ldapauth'", $account->uid);
    user_save($account, $data);
    drupal_set_message(t('User, @name, converted from an LDAP authenticated user to a local Drupal user.', array(
      '@name' => $account->name,
    )));
  }
  drupal_goto('user/' . $account->uid);
}