You are here

function multiple_email_cron in Multiple E-mail Addresses 5

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

Implementation of hook_cron()

File

./multiple_email.module, line 214
multiple_email module file

Code

function multiple_email_cron() {
  $deadline = (int) variable_get('multiple_email_confirm_deadline', 5);
  if ($deadline) {
    $result = db_query("\n      SELECT \n        e.eid,\n        e.time_code_generated,\n        IF(u.mail = e.email, 1, 0) as primary_address \n      FROM \n        {multiple_email} e\n        INNER JOIN {users} u ON (u.uid = e.uid)\n      WHERE confirmed=0");
    $now = time();
    while ($row = db_fetch_object($result)) {
      if (strtotime("+{$deadline} days", $row->time_code_generated) <= $now && !$row->primary_address) {
        multiple_email_expire_address($row->eid);
      }
    }
  }
}