You are here

function user_delete_settings in User Delete 6.2

Same name and namespace in other branches
  1. 5 user_delete.module \user_delete_settings()
  2. 6 user_delete.admin.inc \user_delete_settings()

Administrative settings page

Return value

array a form array

1 string reference to 'user_delete_settings'
user_delete_menu in ./user_delete.module
Implementation of hook_menu().

File

./user_delete.admin.inc, line 17
User delete - Administration page

Code

function user_delete_settings() {

  // These email tokens are shared for all settings, so just define
  // the list once to help ensure they stay in sync.
  $email_token_help = t('Available variables are:') . ' !username, !site, !password, !uri, !uri_brief, !mailto, !date, !login_uri, !edit_uri, !login_url.';
  $form['registration_cancellation'] = array(
    '#type' => 'fieldset',
    '#title' => t('Settings for account cancellation'),
  );
  $form['registration_cancellation']['user_cancel_method'] = array(
    '#type' => 'item',
    '#title' => t('When cancelling a user account'),
    '#description' => t('Users with the %select-cancel-method or %administer-users <a href="@permissions-url">permissions</a> can override this default method.', array(
      '%select-cancel-method' => t('Select method for cancelling account'),
      '%administer-users' => t('Administer users'),
      '@permissions-url' => url('admin/user/permissions'),
    )),
  );
  $form['registration_cancellation']['user_cancel_method'] += user_delete_cancel_methods();
  foreach (element_children($form['registration_cancellation']['user_cancel_method']) as $element) {

    // Remove all account cancellation methods that have #access defined, as
    // those cannot be configured as default method.
    if (isset($form['registration_cancellation']['user_cancel_method'][$element]['#access'])) {
      $form['registration_cancellation']['user_cancel_method'][$element]['#access'] = FALSE;
    }
    else {
      unset($form['registration_cancellation']['user_cancel_method'][$element]['#description']);
    }
  }
  $form['email_cancel_confirm'] = array(
    '#type' => 'fieldset',
    '#title' => t('Account cancellation confirmation'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => t('Edit the e-mail messages sent to users when they attempt to cancel their accounts.') . ' ' . $email_token_help,
  );
  $form['email_cancel_confirm']['user_mail_cancel_confirm_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject'),
    '#default_value' => _user_delete_mail_text('cancel_confirm_subject'),
    '#maxlength' => 180,
  );
  $form['email_cancel_confirm']['user_mail_cancel_confirm_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Body'),
    '#default_value' => _user_delete_mail_text('cancel_confirm_body'),
    '#rows' => 3,
  );
  $form['email_canceled'] = array(
    '#type' => 'fieldset',
    '#title' => t('Account canceled'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => t('Enable and edit e-mail messages sent to users when their accounts are canceled.') . ' ' . $email_token_help,
  );
  $form['email_canceled']['user_mail_status_canceled_notify'] = array(
    '#type' => 'checkbox',
    '#title' => t('Notify user when account is canceled.'),
    '#default_value' => variable_get('user_mail_status_canceled_notify', FALSE),
  );
  $form['email_canceled']['user_mail_status_canceled_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject'),
    '#default_value' => _user_delete_mail_text('status_canceled_subject'),
    '#maxlength' => 180,
  );
  $form['email_canceled']['user_mail_status_canceled_body'] = array(
    '#type' => 'textarea',
    '#title' => t('Body'),
    '#default_value' => _user_delete_mail_text('status_canceled_body'),
    '#rows' => 3,
  );
  return system_settings_form($form);
}