You are here

private function SimpleLdapUserController::delete_single in Simple LDAP 7.2

Delete a user from the system.

This is a copy of user_delete() minus the user_load() call.

1 call to SimpleLdapUserController::delete_single()
SimpleLdapUserController::load in simple_ldap_user/SimpleLdapUserController.class.php
Verifies that the user exists in the LDAP directory.

File

simple_ldap_user/SimpleLdapUserController.class.php, line 87
SimpleLdapUserController class.

Class

SimpleLdapUserController
Controller class for LDAP users.

Code

private function delete_single(stdClass $account) {
  $uids = array(
    $account->uid,
  );
  $transaction = db_transaction();
  try {
    module_invoke_all('user_delete', $account);
    module_invoke_all('entity_delete', $account, 'user');
    field_attach_delete('user', $account);
    drupal_session_destroy_uid($account->uid);
    db_delete('users')
      ->condition('uid', $uids, 'IN')
      ->execute();
    db_delete('users_roles')
      ->condition('uid', $uids, 'IN')
      ->execute();
    db_delete('authmap')
      ->condition('uid', $uids, 'IN')
      ->execute();
  } catch (Exception $e) {
    $transaction
      ->rollback();
    watchdog_exception('user', $e);
    throw $e;
  }
  $this
    ->resetCache($uids);
}