You are here

function advuser_settings in Advanced User 5.2

Same name and namespace in other branches
  1. 5 advuser.module \advuser_settings()
  2. 6.3 forms/advuser_settings.inc \advuser_settings()
  3. 6.2 advuser.module \advuser_settings()
  4. 7.3 forms/advuser_settings.inc \advuser_settings()

advuser settings page

1 string reference to 'advuser_settings'
advuser_menu in ./advuser.module
Implementation of hook_menu().

File

./advuser.module, line 405
Advanced user module allows you to select users based on an advanced set of filtering and apply actions to block, unblock, delete or email the selected users.

Code

function advuser_settings() {
  $form['advuser_mail'] = array(
    '#type' => 'fieldset',
    '#title' => t('Mail notifications on user account activity.'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );
  $form['advuser_mail']['variables'] = array(
    '#type' => 'markup',
    '#prefix' => '<div class="advuser-inset-panel">',
    '#value' => t(ADVUSER_SUBSTITUTION_TEXT),
    '#suffix' => '</div>',
  );

  //New User Notification
  $form['advuser_mail']['advuser_new_notify'] = array(
    '#type' => 'checkbox',
    '#title' => t('Send notifications on new user registration'),
    '#description' => t('Notify selected roles when new users register.'),
    '#default_value' => variable_get('advuser_new_notify', FALSE),
  );
  $form['advuser_mail']['advuser_new_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Mail subject'),
    '#description' => t('The subject of the mail that is going to be sent to the user.  You may insert substitution variables within this item.'),
    '#default_value' => variable_get('advuser_new_subject', NULL),
  );
  $form['advuser_mail']['advuser_new_mail'] = array(
    '#type' => 'textarea',
    '#title' => t('Mail body'),
    '#description' => t('The mail that is going to be sent to the selected roles.  You may insert substitution variables within this item.'),
    '#default_value' => variable_get('advuser_new_mail', NULL),
  );

  //User change notification
  $form['advuser_mail']['advuser_modify_notify'] = array(
    '#type' => 'checkbox',
    '#title' => t('Send notifications on user profile updates'),
    '#description' => t('Notify selected roles when users update their profiles.'),
    '#default_value' => variable_get('advuser_modify_notify', FALSE),
  );
  $form['advuser_mail']['advuser_modify_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Mail subject'),
    '#description' => t('The subject of the mail that is going to be sent when a user modifies their profiles.  You may insert substitution variables within this item.'),
    '#default_value' => variable_get('advuser_modify_subject', NULL),
  );
  $form['advuser_mail']['advuser_modify_mail'] = array(
    '#type' => 'textarea',
    '#title' => t('Mail body'),
    '#description' => t('The mail that is going to be sent to the selected roles when a user modifies their account.  You may insert substitution variables within this item.'),
    '#default_value' => variable_get('advuser_modify_mail', NULL),
  );

  //Maximum rows in dataset to display
  $form['advuser_mail']['advuser_listno'] = array(
    '#type' => 'select',
    '#options' => drupal_map_assoc(array(
      1,
      10,
      25,
      50,
      75,
      100,
      125,
      150,
      175,
      200,
    )),
    '#title' => t('Number of users in listing'),
    '#description' => t('Sets how many users to display in table view'),
    '#default_value' => variable_get('advuser_listno', 50),
  );
  $sel_roles_count = count(users_by_access('receive email advuser'));
  if ($sel_roles_count == 0) {
    $form['advuser_mailonnew']['no_roles_sel_warning'] = array(
      '#type' => 'markup',
      '#prefix' => '<div class="advuser-settings-warning">',
      '#value' => '<strong>WARNING: No users have "receive email advuser" ' . l('access permissions', 'admin/user/access') . '!</strong> - No email notifications will be sent.',
      '#suffix' => '</div>',
    );
  }
  if (module_exists('profile')) {
    $form['advuser_profile'] = array(
      '#type' => 'fieldset',
      '#title' => t('Profile module special settings'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $fields = array();
    $result = db_query('SELECT * FROM {profile_fields} ORDER BY category, weight');
    while ($row = db_fetch_object($result)) {
      $fields[$row->fid] = $row->title;
    }
    $values = array();
    $options = variable_get('advuser_profile_fields', NULL);
    foreach ((array) $options as $opt => $v) {
      if ($v > 0) {
        $values[] = $v;
      }
    }
    $form['advuser_profile']['advuser_profile_fields'] = array(
      '#type' => 'checkboxes',
      '#description' => t('Profile fields to be used as filters for the users.'),
      '#title' => t('Profile fields'),
      '#options' => $fields,
      '#default_value' => $values,
    );
  }
  return system_settings_form($form);
}