You are here

function user_email_verification_block_account in User email verification 7

Block user account if active and email user if extended verification is enabled

1 call to user_email_verification_block_account()
user_email_verification_task in ./user_email_verification.module
Queue worker callback for running a single task.

File

./user_email_verification.module, line 43
This module allows you to have e-mail verification and in meanwhile allowing the users to type their own passwords. If they do not verify their accounts in a certain time interval the user will be blocked.

Code

function user_email_verification_block_account($uid) {
  $account = user_load($uid);

  // If the account is active, it shold be blocked
  if ($account->status == 1) {
    $account->status = 0;
    user_save($account);
    if (module_exists('rules')) {

      // Invoke rules event
      rules_invoke_event('user_email_verification_account_blocked', $account);
    }

    // If extended verification period is enabled, then send e-mail to user with
    // a link which lets user to activate and verify the account within defined
    // time period.
    if (variable_get('user_email_verification_extended_enable', 0)) {
      $params['account'] = $account;
      $mail = drupal_mail('user_email_verification', 'verify_extended', $account->mail, $account->language, $params);
    }
  }
}