You are here

function user_import_configure_form in User Import 7.3

Same name and namespace in other branches
  1. 8 user_import.admin.inc \user_import_configure_form()
  2. 5.2 user_import.module \user_import_configure_form()
  3. 5 user_import.module \user_import_configure_form()
  4. 6.4 user_import.admin.inc \user_import_configure_form()
  5. 6.2 user_import.admin.inc \user_import_configure_form()
  6. 7 user_import.admin.inc \user_import_configure_form()
  7. 7.2 user_import.admin.inc \user_import_configure_form()

Configuration form define (settings affect all user imports)

1 string reference to 'user_import_configure_form'
user_import_menu in ./user_import.module
Implementation of hook_menu().

File

./user_import.admin.inc, line 173
Provide administration configuration pages to import users.

Code

function user_import_configure_form() {
  $form['general'] = array(
    '#type' => 'fieldset',
    '#title' => t('General'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['general']['delimiter'] = array(
    '#type' => 'textfield',
    '#title' => t('Delimiter'),
    '#size' => 4,
    '#default_value' => variable_get('user_import_delimiter', ','),
    '#required' => TRUE,
    '#description' => t("The default column delimiter. Use '\\t' for Tab."),
  );
  $form['general']['encoding'] = array(
    '#type' => 'select',
    '#title' => t('Character Encoding'),
    '#options' => array(
      'UTF-8' => t('UTF-8'),
      'Windows-1252' => t('Windows-1252'),
    ),
    '#default_value' => variable_get('user_import_encoding', 'UTF-8'),
    '#required' => TRUE,
    '#description' => t('Select the default encoding.'),
  );
  $form['general']['nomail'] = array(
    '#type' => 'textfield',
    '#title' => t('Domain for nomail'),
    '#size' => 8,
    '#default_value' => variable_get('user_import_nomail', 'nomail'),
    '#required' => TRUE,
    '#description' => t('Users without a valid email-address can be given a pseudo-email in this domain in the CSV-file.'),
  );
  $form['selectable_files'] = array(
    '#type' => 'fieldset',
    '#title' => t('Uploads Directory'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  if (variable_get('user_import_selectable_files', 0) == 0) {
    $selectable_files_description = t('This option provides a directory where files can be uploaded, and then selected when setting up an import.');
  }
  else {
    $selectable_files_description = t('');
  }
  $form['selectable_files']['selectable_files'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable Uploads Directory'),
    '#description' => $selectable_files_description,
    '#default_value' => variable_get('user_import_selectable_files', 0),
  );
  $form['auto_imports'] = array(
    '#type' => 'fieldset',
    '#title' => t('Automated Imports'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['auto_imports']['auto_imports_enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable Automated Imports'),
    '#description' => t('Each import template will have the option to create a directory which will be scanned for any files that have been uploaded to it,
                           and when a file is found it will automatically be used to create new user accounts. Directories are scanned durring !cron runs.', array(
      '!cron' => l(t('cron'), 'admin/config/system/cron'),
    )),
    '#default_value' => variable_get('user_import_auto_imports_enabled', 0),
  );
  $form['performance'] = array(
    '#type' => 'fieldset',
    '#title' => t('Performance'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['performance']['user_import_max'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum Users/Process'),
    '#default_value' => variable_get('user_import_max', 250),
    '#size' => 10,
    '#maxlength' => 10,
    '#description' => t('Maximum number of users to import each time the file is processed, useful for controling the rate at which emails are sent out.'),
  );
  $form['performance']['user_import_line_max'] = array(
    '#type' => 'textfield',
    '#title' => t('Maximum length of line'),
    '#default_value' => variable_get('user_import_line_max', 1000),
    '#size' => 10,
    '#maxlength' => 10,
    '#description' => t('The default is set at 1,000 characters, if a line in your csv is longer than this you should set a higher maximum here. Setting higher maximums will slow down imports.'),
  );
  $saved_templates = _user_import_settings_select(NULL, TRUE);
  if (!empty($saved_templates)) {
    $form['settings_templates'] = array(
      '#type' => 'fieldset',
      '#title' => t('Settings Templates'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $templates_list = array(
      '-- none --',
    );
    foreach ($saved_templates as $template) {
      $templates_list[$template['import_id']] = $template['name'];
      $templates_delete[$template['import_id']] = $template['name'];
    }
    $form['settings_templates']['user_import_settings'] = array(
      '#type' => 'select',
      '#title' => t('Default Settings'),
      '#description' => t('Select if you want to use a previously saved set of settings as default for all imports.'),
      '#default_value' => variable_get('user_import_settings', 0),
      '#options' => $templates_list,
    );
    $form['settings_templates']['templates'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Delete Templates'),
      '#options' => $templates_delete,
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}