You are here

function multiple_email_cron in Multiple E-mail Addresses 7

Same name and namespace in other branches
  1. 5 multiple_email.module \multiple_email_cron()
  2. 6 multiple_email.module \multiple_email_cron()
  3. 2.x multiple_email.module \multiple_email_cron()

Implements hook_cron().

File

./multiple_email.module, line 321
multiple_email module file

Code

function multiple_email_cron() {
  $deadline = (int) variable_get('multiple_email_confirm_deadline', 5);
  if ($deadline) {
    $query = db_select('multiple_email', 'me');
    $query
      ->fields('me', array(
      'eid',
    ));
    $query
      ->join('users', 'u', 'u.uid = me.uid');
    $query
      ->condition('me.confirmed', 0);
    $query
      ->condition('me.time_code_generated', strtotime('-' . $deadline . ' days'), '<');
    $query
      ->condition('me.email', 'u.mail', 'NOT LIKE');
    $result = $query
      ->execute()
      ->fetchCol();
    foreach ($result as $eid) {
      multiple_email_expire_address($eid);
    }
  }
}