You are here

function regcode_admin_settings in Registration codes 5.3

Same name and namespace in other branches
  1. 5 regcode.module \regcode_admin_settings()
  2. 6.2 regcode.admin.php \regcode_admin_settings()
  3. 6 regcode.admin.php \regcode_admin_settings()
  4. 7.2 regcode.admin.inc \regcode_admin_settings()
  5. 7 regcode.admin.php \regcode_admin_settings()

Return the form associated with the module settings.

Return value

The settings form.

1 string reference to 'regcode_admin_settings'
regcode_menu in ./regcode.module
Define menu items and page callbacks.

File

./regcode_admin.inc.php, line 25
regcode_admin.inc.php contains the top-level logic for the administration pages for the registration-code module

Code

function regcode_admin_settings() {
  $roles = user_roles();
  $form['#cache'] = FALSE;
  $form['regcode_optional'] = array(
    '#type' => 'checkbox',
    '#title' => t("Make registration code optional"),
    '#default_value' => variable_get('regcode_optional', 0),
    '#description' => t('If checked, users can register without a registration code') . '. ' . t('Alternatively, there is also a permission to allow certain roles (e.g. admins) to bypass´registration code entry for administratively added users.'),
  );
  $form['regcode_fieldtitle'] = array(
    '#type' => 'textfield',
    '#title' => t("Field title"),
    '#description' => t('The title of the registration code textfield'),
    '#default_value' => variable_get('regcode_fieldtitle', ''),
  );
  $form['regcode_fielddescription'] = array(
    '#type' => 'textfield',
    '#title' => t("Field description"),
    '#description' => t('The description of the registration code textfield'),
    '#default_value' => variable_get('regcode_fielddescription', ''),
  );
  $form['regcode_import'] = array(
    '#type' => 'fieldset',
    '#title' => t("CSV import"),
    '#description' => t('Settings to use for code import.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['regcode_import']['regcode_import_action'] = array(
    '#type' => 'select',
    '#title' => t("Action"),
    '#default_value' => variable_get('regcode_import_action', 'skip'),
    '#options' => array(
      'skip' => t('Skip'),
      'overwrite' => t('Overwrite'),
      'clean' => t('Clean'),
    ),
    '#description' => t('Action to perform when importing the data.<br />
                           - <b>Skip</b>: Add new codes skipping those which already exists.<br />
                           - <b>Overwrite</b>: Add new codes overwriting those which already exists.<br />
                           - <b>Clean</b>: Erases *all* existing codes before importing new codes.<br />
                          '),
  );
  $form['regcode_import']['regcode_import_csv_delimiter'] = array(
    '#type' => 'textfield',
    '#title' => t("Field delimiter"),
    '#description' => t('Character used as delimiter in csv import of registration codes'),
    '#default_value' => variable_get('regcode_import_csv_delimiter', ','),
  );
  $form['regcode_import']['regcode_import_csv_text_enclosure'] = array(
    '#type' => 'textfield',
    '#title' => t("Text enclosure"),
    '#default_value' => variable_get('regcode_import_csv_text_enclosure', '"'),
    '#description' => t('Character used as enclosure around text content fields on CSV import.'),
  );
  $form['regcode_import']['regcode_import_csv_fieldorder'] = array(
    '#type' => 'textfield',
    '#title' => t("Field order"),
    '#default_value' => variable_get('regcode_import_csv_fieldorder', 'code'),
    '#description' => t('Order in which fields are expected in the CSV file (field names separated by delimiter set above).
                              <br />Leave BLANK to use a field header line in the CSV data.
                              <br />Example: "IGNORE,code,rid,info"
                              <br />Available field names:
                                  <pre>
  IGNORE              - Ignore the data at this field position.
  code                - The code string itself.
  available           - "1" (available) or "0" (not available).
  reuse               - "1" (for many users) or "0" (only for one user once).
  rid                 - Role-id to grant the user upon registration with this code.
  expire - Date/timestamp to expire this code from being available (or leave empty).
  revoke     - Date/timestamp to revoke the registration/role granted by this code ( " ).
  info                - String field for free custom usage.
                                  </pre>'),
  );
  regcode_form_add_codetemplate($form);
  $form = system_settings_form($form);
  return $form;
}