function notify_admin_users in Notify 7
Same name and namespace in other branches
- 5.2 notify.module \notify_admin_users()
- 5 notify.module \notify_admin_users()
- 6 notify.module \notify_admin_users()
Menu callback, show admin list of user notification settings.
1 string reference to 'notify_admin_users'
- notify_menu in ./
notify.module - Implements hook_menu().
File
- ./
notify.admin.inc, line 722 - Administrative pages callbacks for the Notify module.
Code
function notify_admin_users($form, &$form_state) {
$form = array();
$form['#tree'] = TRUE;
$form['info'] = array(
'#markup' => '<p>' . t('The following table shows all users that have notifications enabled:' . '</p>'),
);
$form['users'] = array();
// Fetch users with notify enabled.
$q = db_select('notify', 'n');
$q
->join('users', 'u', 'n.uid = u.uid');
$q
->fields('u', array(
'uid',
'name',
'mail',
'language',
));
$q
->fields('n', array(
'status',
'node',
'comment',
'attempts',
'teasers',
));
$q
->condition('n.status', 1);
$q
->condition('u.status', 1);
$q
->orderBy('u.name');
$uresult = $q
->execute();
foreach ($uresult as $user) {
$form['users'][$user->uid] = array();
$form['users'][$user->uid]['name'] = array(
'#markup' => theme('username', array(
'account' => $user,
)),
);
$form['users'][$user->uid]['mail'] = array(
'#markup' => $user->mail,
);
$form['users'][$user->uid]['node'] = array(
'#type' => 'checkbox',
'#default_value' => $user->node,
);
$form['users'][$user->uid]['comment'] = array(
'#type' => 'checkbox',
'#default_value' => $user->comment,
);
$form['users'][$user->uid]['teasers'] = array(
'#type' => 'select',
'#default_value' => $user->teasers,
'#options' => array(
t('Title only'),
t('Title + Teaser'),
t('Title + Body'),
t('Title + Body + Fields'),
),
);
$form['users'][$user->uid]['attempts'] = array(
'#markup' => $user->attempts ? intval($user->attempts) : 0,
);
}
$form['info2'] = array(
'#markup' => '<p>' . t("You may check/uncheck the checkboxes and the “How much”-selection to change the users' subscriptions. Press “Save settings” to save the settings." . '</p><h3>' . t('Automatic enrollment tickboxes') . '</h3>'),
);
$form['import'] = array(
'#title' => t('Subscribe users when importing'),
'#type' => 'checkbox',
'#default_value' => variable_get('notify_import', 0),
'#description' => t('Subscribe users that are imported by means of <strong>User Import</strong> (and similiar tools).'),
);
$form['bulk'] = array(
'#title' => t('Subscribe all users now'),
'#type' => 'checkbox',
'#default_value' => FALSE,
'#description' => t('Subscribe all non-blocked users that do not already subscribe to notifications.'),
);
$form['info3'] = array(
'#markup' => '<p>' . t("Press “Save settings” if you have changed setting for automatic enrollment." . '</p>'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save settings'),
);
return $form;
}