You are here

function notify_admin_users_submit in Notify 5.2

Same name and namespace in other branches
  1. 5 notify.module \notify_admin_users_submit()
  2. 6 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 249

Code

function notify_admin_users_submit($form_id, $form_values) {
  if ($form_values['users']) {
    foreach ($form_values['users'] as $uid => $settings) {
      db_query('UPDATE {notify} SET node = %d, teasers = %d, comment = %d WHERE uid = %d', $settings['node'], $settings['teasers'], $settings['comment'], $uid);
    }
  }
  drupal_set_message(t('Notify settings saved.'));
  if ($form_values['flush']) {
    list($num_sent, $num_failed) = _notify_send();
    variable_set('notify_send_last', time());
    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.'));
    }
  }
}