You are here

function domain_user_configure_form in Domain Access 5

Same name and namespace in other branches
  1. 6.2 domain_user/domain_user.admin.inc \domain_user_configure_form()

FormsAPI

1 string reference to 'domain_user_configure_form'
domain_user_menu in domain_user/domain_user.module
Implement hook_menu()

File

domain_user/domain_user.module, line 58
Creates unique subdomains for registered users.

Code

function domain_user_configure_form() {
  drupal_set_title(t('User domain settings'));
  $form = array();
  $form['domain_user'] = array(
    '#type' => 'radios',
    '#title' => t('Module behavior'),
    '#options' => array(
      0 => t('Do not create domains for users'),
      1 => t('Automatically create domains for new users'),
      2 => t('Ask users if they would like to create a domain'),
    ),
    '#description' => t('Should subdomains be created when users register?'),
    '#default_value' => variable_get('domain_user', 0),
  );
  $form['domain_user_root'] = array(
    '#type' => 'textfield',
    '#title' => t('Root domain name'),
    '#size' => 40,
    '#maxlength' => 80,
    '#required' => TRUE,
    '#default_value' => variable_get('domain_user_root', variable_get('domain_root', '')),
    '#description' => t('The root domain to use for creating user domains, typically <em>example.com</em>.  No http or slashes.
      <br /> When users create domains, their username will be added to the root domain to create a custom domain.
      <br /> For example, <em>user1.example.com</em> or <em>administrator.example.com</em>.'),
  );
  $form['domain_user_scheme'] = array(
    '#type' => 'radios',
    '#title' => t('User Domain URL scheme'),
    '#options' => array(
      'http' => 'http://',
      'https' => 'https://',
    ),
    '#default_value' => variable_get('domain_user_scheme', 'http'),
    '#description' => t('The URL scheme for accessing user domains.'),
  );
  $form['domain_user_login'] = array(
    '#type' => 'radios',
    '#title' => t('User login behavior'),
    '#options' => array(
      1 => t('On login, go to personal domain'),
      0 => t('Do not go to personal domain on login'),
    ),
    '#default_value' => variable_get('domain_user_login', 1),
    '#description' => t('The domain users should go to when they login to the site.'),
  );
  if (module_exists('domain_prefix')) {
    $form['domain_user_prefixing'] = array(
      '#type' => 'radios',
      '#title' => t('Domain table prefixing'),
      '#options' => array(
        0 => t('Never create prefixed tabled for user domains'),
        1 => t('Obey the settings in Domain Prefix'),
      ),
      '#description' => t('Should user domains have detabase talbes created?'),
      '#default_value' => variable_get('domain_user_prefixing', 0),
    );
  }

  // Show the rules for username restrictions
  $rules = domain_user_rules();
  if (!empty($rules)) {
    $output = '<ul>';
    foreach ($rules as $rule) {
      $output .= '<li>' . $rule . '</li>';
    }
    $output .= '</ul>';
  }
  $form['rules'] = array(
    '#type' => 'markup',
    '#weight' => 20,
    '#value' => '<br /><br />' . t('<h3>Reserved Usernames</h3><p>The following usernames cannot be registered, since they are used as unique subdomains:</p>') . $output,
  );
  return system_settings_form($form);
}