You are here

function _password_policy_unblock in Password Policy 6

Unblocks the expired account.

Parameters

$account: User object.

1 call to _password_policy_unblock()
password_policy_expired_unblock_confirm_submit in ./password_policy.module
Unblocks the expired account.

File

./password_policy.module, line 986
The password policy module allows you to enforce a specific level of password complexity for the user passwords on the system.

Code

function _password_policy_unblock($account) {

  // Check if user was blocked via this module.
  $pp_blocked = db_result(db_query('SELECT pid FROM {password_policy_expiration} ppe
      WHERE blocked <> 0
      AND unblocked IS NULL
      AND uid = %d', $account->uid));
  if ($pp_blocked) {
    db_query('UPDATE {password_policy_expiration} ppe
      SET unblocked = %d
      WHERE uid = %d AND unblocked IS NULL', time(), $account->uid);

    // Unblock the user.
    user_save($account, array(
      'status' => 1,
    ));
    drupal_set_message(t('The user %name has been unblocked.', array(
      '%name' => $account->name,
    )));
  }
}