You are here

function _signup_date_reminder_sql in Signup 5.2

Same name in this branch
  1. 5.2 includes/date.5x-2.inc \_signup_date_reminder_sql()
  2. 5.2 includes/date.5x-1.inc \_signup_date_reminder_sql()
Same name and namespace in other branches
  1. 6.2 includes/date.inc \_signup_date_reminder_sql()
  2. 6 includes/date.inc \_signup_date_reminder_sql()
  3. 7 includes/date.inc \_signup_date_reminder_sql()

Return value

Array of SQL clauses for cron reminder email query builder.

1 call to _signup_date_reminder_sql()
signup_reminder_sql in includes/scheduler.inc

File

includes/date.5x-1.inc, line 13
Code required to support version 5.x-1.* of the CCK date field module.

Code

function _signup_date_reminder_sql($content_type) {
  require_once drupal_get_path('module', 'date') . '/date.inc';
  global $db_type;
  $day = $db_type == 'pgsql' ? 'days' : 'DAY';
  $field = signup_date_field($content_type);
  $date_type = $field['type'] == 'datestamp' ? 'int' : 'iso';
  $start_time = date_sql('DATE', $field['database']['columns']['value']['column'], $date_type);
  $where = "NOW() + INTERVAL s.reminder_days_before " . $day . " > " . $start_time;
  return array(
    'fields' => array(
      $field['database']['columns']['value']['column'],
    ),
    'joins' => array(
      'INNER JOIN {' . $field['database']['table'] . '}  ON {' . $field['database']['table'] . '}.vid = n.vid',
    ),
    'where' => array(
      $where,
    ),
  );
}