You are here

function user_email_verification_install in User email verification 7

Same name and namespace in other branches
  1. 8 user_email_verification.install \user_email_verification_install()

Implements hook_enable()

File

./user_email_verification.install, line 10
The module installation functions.

Code

function user_email_verification_install() {

  // TODO: Think of making this in batch operation cause if there are many users it will timeout the installation!
  $result = db_select('users')
    ->fields('users', array(
    'uid',
  ))
    ->condition('uid', 1, '>')
    ->execute();
  $query = db_insert('user_email_verification')
    ->fields(array(
    'uid',
    'verified',
  ));
  $execute = FALSE;
  foreach ($result as $account) {
    $execute = TRUE;
    $query
      ->values(array(
      'uid' => $account->uid,
      'verified' => 1,
    ));
  }
  if ($execute) {
    $query
      ->execute();
  }
}