You are here

function password_policy_user_delete in Password Policy 7

Same name and namespace in other branches
  1. 7.2 password_policy.module \password_policy_user_delete()

Implements hook_user_delete().

File

./password_policy.module, line 438
Allows enforcing restrictions on user passwords by defining policies.

Code

function password_policy_user_delete($account) {
  $txn = db_transaction();

  // Ensure all deletes occur.
  try {
    db_delete('password_policy_history')
      ->condition('uid', $account->uid)
      ->execute();
    db_delete('password_policy_expiration')
      ->condition('uid', $account->uid)
      ->execute();
    db_delete('password_policy_force_change')
      ->condition('uid', $account->uid)
      ->execute();
  } catch (Exception $e) {

    // Something went wrong somewhere, so roll back now.
    $txn
      ->rollback();

    // Log the exception to watchdog.
    watchdog_exception('type', $e);
  }
}