You are here

function notify_admin_users in Notify 5.2

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

Menu callback; show admininster user notification settings form.

1 string reference to 'notify_admin_users'
notify_menu in ./notify.module
Implementation of hook_menu().

File

./notify.module, line 216

Code

function notify_admin_users() {
  $form = array();
  $form['#tree'] = TRUE;
  $form['info'] = array(
    '#value' => t('The following table shows all users that have notifications enabled.'),
  );
  $form['users'] = array();
  $result = db_query('SELECT u.uid, u.name, u.mail, n.* FROM {users} u LEFT JOIN {notify} n ON u.uid = n.uid WHERE n.status = 1 AND u.status = 1 ORDER BY u.name');
  while ($notify = db_fetch_object($result)) {
    $form['users'][$notify->uid] = array();
    $form['users'][$notify->uid]['name'] = array(
      '#type' => 'markup',
      '#value' => theme('username', $notify),
    );
    $form['users'][$notify->uid]['mail'] = array(
      '#type' => 'markup',
      '#value' => $notify->mail,
    );
    $form['users'][$notify->uid]['node'] = array(
      '#type' => 'checkbox',
      '#default_value' => $notify->node,
    );
    $form['users'][$notify->uid]['teasers'] = array(
      '#type' => 'select',
      '#default_value' => $notify->teasers,
      '#options' => array(
        t('Title only'),
        t('Title + Teaser'),
        t('Title + Body'),
      ),
    );
    $form['users'][$notify->uid]['comment'] = array(
      '#type' => 'checkbox',
      '#default_value' => $notify->comment,
    );
    $form['users'][$notify->uid]['attempts'] = array(
      '#type' => 'markup',
      '#value' => $notify->attempts ? intval($notify->attempts) : 0,
    );
  }
  $form['flush'] = array(
    '#title' => t('Flush e-mail queue'),
    '#type' => 'checkbox',
    '#default_value' => FALSE,
    '#description' => t('Send out any pending notification e-mails currently in queue.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save settings'),
  );
  return $form;
}