You are here

function user_admin_settings in Drupal 5

Same name and namespace in other branches
  1. 6 modules/user/user.admin.inc \user_admin_settings()
  2. 7 modules/user/user.admin.inc \user_admin_settings()
1 string reference to 'user_admin_settings'
user_menu in modules/user/user.module
Implementation of hook_menu().

File

modules/user/user.module, line 2329
Enables the user registration and login system.

Code

function user_admin_settings() {

  // User registration settings.
  $form['registration'] = array(
    '#type' => 'fieldset',
    '#title' => t('User registration settings'),
  );
  $form['registration']['user_register'] = array(
    '#type' => 'radios',
    '#title' => t('Public registrations'),
    '#default_value' => variable_get('user_register', 1),
    '#options' => array(
      t('Only site administrators can create new user accounts.'),
      t('Visitors can create accounts and no administrator approval is required.'),
      t('Visitors can create accounts but administrator approval is required.'),
    ),
  );
  $form['registration']['user_email_verification'] = array(
    '#type' => 'checkbox',
    '#title' => t('Require e-mail verification when a visitor creates an account'),
    '#default_value' => variable_get('user_email_verification', TRUE),
    '#description' => t('If this box is checked, new users will be required to validate their e-mail address prior to logging into to the site, and will be assigned a system-generated password. With it unchecked, users will be logged in immediately upon registering, and may select their own passwords during registration.'),
  );
  $form['registration']['user_registration_help'] = array(
    '#type' => 'textarea',
    '#title' => t('User registration guidelines'),
    '#default_value' => variable_get('user_registration_help', ''),
    '#description' => t("This text is displayed at the top of the user registration form. It's useful for helping or instructing your users."),
  );

  // User e-mail settings.
  $form['email'] = array(
    '#type' => 'fieldset',
    '#title' => t('User e-mail settings'),
  );
  $form['email']['user_mail_welcome_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject of welcome e-mail'),
    '#default_value' => _user_mail_text('welcome_subject'),
    '#maxlength' => 180,
    '#description' => t('Customize the subject of your welcome e-mail, which is sent to new members upon registering.') . ' ' . t('Available variables are:') . ' !username, !site, !password, !uri, !uri_brief, !mailto, !date, !login_uri, !edit_uri, !login_url.',
  );
  $form['email']['user_mail_welcome_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Body of welcome e-mail'),
    '#default_value' => _user_mail_text('welcome_body'),
    '#rows' => 15,
    '#description' => t('Customize the body of the welcome e-mail, which is sent to new members upon registering.') . ' ' . t('Available variables are:') . ' !username, !site, !password, !uri, !uri_brief, !mailto, !login_uri, !edit_uri, !login_url.',
  );
  $form['email']['user_mail_admin_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject of welcome e-mail (user created by administrator)'),
    '#default_value' => _user_mail_text('admin_subject'),
    '#maxlength' => 180,
    '#description' => t('Customize the subject of your welcome e-mail, which is sent to new member accounts created by an administrator.') . ' ' . t('Available variables are:') . ' !username, !site, !password, !uri, !uri_brief, !mailto, !date, !login_uri, !edit_uri, !login_url.',
  );
  $form['email']['user_mail_admin_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Body of welcome e-mail (user created by administrator)'),
    '#default_value' => _user_mail_text('admin_body'),
    '#rows' => 15,
    '#description' => t('Customize the body of the welcome e-mail, which is sent to new member accounts created by an administrator.') . ' ' . t('Available variables are:') . ' !username, !site, !password, !uri, !uri_brief, !mailto, !login_uri, !edit_uri, !login_url.',
  );
  $form['email']['user_mail_approval_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject of welcome e-mail (awaiting admin approval)'),
    '#default_value' => _user_mail_text('approval_subject'),
    '#maxlength' => 180,
    '#description' => t('Customize the subject of your awaiting approval welcome e-mail, which is sent to new members upon registering.') . ' ' . t('Available variables are:') . ' !username, !site, !password, !uri, !uri_brief, !mailto, !date, !login_uri, !edit_uri, !login_url.',
  );
  $form['email']['user_mail_approval_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Body of welcome e-mail (awaiting admin approval)'),
    '#default_value' => _user_mail_text('approval_body'),
    '#rows' => 15,
    '#description' => t('Customize the body of the awaiting approval welcome e-mail, which is sent to new members upon registering.') . ' ' . t('Available variables are:') . ' !username, !site, !password, !uri, !uri_brief, !mailto, !login_uri, !edit_uri, !login_url.',
  );
  $form['email']['user_mail_pass_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject of password recovery e-mail'),
    '#default_value' => _user_mail_text('pass_subject'),
    '#maxlength' => 180,
    '#description' => t('Customize the subject of your forgotten password e-mail.') . ' ' . t('Available variables are:') . ' !username, !site, !login_url, !uri, !uri_brief, !mailto, !date, !login_uri, !edit_uri.',
  );
  $form['email']['user_mail_pass_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Body of password recovery e-mail'),
    '#default_value' => _user_mail_text('pass_body'),
    '#rows' => 15,
    '#description' => t('Customize the body of the forgotten password e-mail.') . ' ' . t('Available variables are:') . ' !username, !site, !login_url, !uri, !uri_brief, !mailto, !login_uri, !edit_uri.',
  );

  // If picture support is enabled, check whether the picture directory exists:
  if (variable_get('user_pictures', 0)) {
    $picture_path = file_create_path(variable_get('user_picture_path', 'pictures'));
    file_check_directory($picture_path, 1, 'user_picture_path');
  }
  $form['pictures'] = array(
    '#type' => 'fieldset',
    '#title' => t('Pictures'),
  );
  $form['pictures']['user_pictures'] = array(
    '#type' => 'radios',
    '#title' => t('Picture support'),
    '#default_value' => variable_get('user_pictures', 0),
    '#options' => array(
      t('Disabled'),
      t('Enabled'),
    ),
    '#description' => t('Enable picture support.'),
  );
  $form['pictures']['user_picture_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Picture image path'),
    '#default_value' => variable_get('user_picture_path', 'pictures'),
    '#size' => 30,
    '#maxlength' => 255,
    '#description' => t('Subdirectory in the directory %dir where pictures will be stored.', array(
      '%dir' => file_directory_path() . '/',
    )),
  );
  $form['pictures']['user_picture_default'] = array(
    '#type' => 'textfield',
    '#title' => t('Default picture'),
    '#default_value' => variable_get('user_picture_default', ''),
    '#size' => 30,
    '#maxlength' => 255,
    '#description' => t('URL of picture to display for users with no custom picture selected. Leave blank for none.'),
  );
  $form['pictures']['user_picture_dimensions'] = array(
    '#type' => 'textfield',
    '#title' => t('Picture maximum dimensions'),
    '#default_value' => variable_get('user_picture_dimensions', '85x85'),
    '#size' => 15,
    '#maxlength' => 10,
    '#description' => t('Maximum dimensions for pictures, in pixels.'),
  );
  $form['pictures']['user_picture_file_size'] = array(
    '#type' => 'textfield',
    '#title' => t('Picture maximum file size'),
    '#default_value' => variable_get('user_picture_file_size', '30'),
    '#size' => 15,
    '#maxlength' => 10,
    '#description' => t('Maximum file size for pictures, in kB.'),
  );
  $form['pictures']['user_picture_guidelines'] = array(
    '#type' => 'textarea',
    '#title' => t('Picture guidelines'),
    '#default_value' => variable_get('user_picture_guidelines', ''),
    '#description' => t("This text is displayed at the picture upload form in addition to the default guidelines. It's useful for helping or instructing your users."),
  );
  return system_settings_form($form);
}