You are here

function notify_admin_users_submit in Notify 6

Same name and namespace in other branches
  1. 5.2 notify.module \notify_admin_users_submit()
  2. 5 notify.module \notify_admin_users_submit()
  3. 7 notify.admin.inc \notify_admin_users_submit()

Submit for the notify_admin form.

File

./notify.module, line 362
Notify module sends email digests of new content and comments.

Code

function notify_admin_users_submit($form, &$form_state) {
  unset($form);
  if ($form_state['values']['users']) {
    foreach ($form_state['values']['users'] as $uid => $settings) {
      db_query('UPDATE {notify} SET node = %d, teasers = %d, comment = %d, attempts = %d WHERE uid = %d', $settings['node'], $settings['teasers'], $settings['comment'], $settings['attempts'], $uid);
    }
  }
  drupal_set_message(t('Notify settings saved.'));
  if ($form_state['values']['flush']) {
    $send_start = time();
    list($num_sent, $num_failed) = _notify_send($send_start);
    variable_set('notify_send_last', $send_start);
    if ($num_sent > 0) {
      drupal_set_message(t('!count pending notification e-mails have been sent.', array(
        '!count' => $num_sent,
      )));
    }
    elseif ($num_failed > 0) {
      drupal_set_message(t('!count notification e-mails could not be sent.', array(
        '!count' => $num_failed,
      )), 'error');
    }
    else {
      drupal_set_message(t('No notification e-mails needed to be sent.'));
    }
  }
}