You are here

function party_user_settings_form in Party 7

Same name and namespace in other branches
  1. 8.2 modules/party_user/party_user.admin.inc \party_user_settings_form()

User integration settings form.

1 string reference to 'party_user_settings_form'
party_user_menu in modules/party_user/party_user.module
Implements hook_menu()

File

modules/party_user/party_user.admin.inc, line 9
Provide config forms for views

Code

function party_user_settings_form($form, &$form_state) {
  $form['party_user_on_registration'] = array(
    '#type' => 'radios',
    '#title' => t('On user registration:'),
    '#options' => array(
      'nothing' => t('Do nothing'),
      'create' => t('Create a new party'),
      'acquire' => t('Acquire an existing party, creating one if necessary'),
    ),
    '#default_value' => variable_get('party_user_on_registration', 'nothing'),
  );
  $options = array();
  foreach (party_get_data_set_info() as $data_set_name => $def) {
    if ($data_set_name != 'user') {
      $options[$data_set_name] = $def['label'];
    }
  }
  if (module_exists('party_hat')) {
    $options = array();
    foreach (party_hat_get_tree() as $hat_name => $hat) {
      $options[$hat_name] = str_repeat('-', $hat->depth) . $hat->label;
    }
    $form['registration_hats'] = array(
      '#type' => 'checkboxes',
      '#options' => $options,
      '#title' => t("What hat's should users' parties be given on registration?"),
      '#default_value' => variable_get('party_user_registration_hats', array()),
    );
  }

  // Retrieve all the data sets so we can look for appropriate fields
  $form['email_sync'] = array(
    '#type' => 'select',
    '#multiple' => TRUE,
    '#options' => party_find_fields_of_types('varchar'),
    '#title' => t('Fields to synchronise with user email'),
    '#description' => t("Any time the user is saved, these fields will be updated to match the user's email address."),
    '#default_value' => variable_get('party_user_email_sync_fields', array()),
    '#size' => 10,
  );
  $form['party_user_format_username'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use Party label to format usernames'),
    '#default_value' => variable_get('party_user_format_username', TRUE),
  );
  $form['party_user_party_delete_action'] = array(
    '#type' => 'radios',
    '#title' => t('What to do with attached users when their Party is deleted'),
    '#default_value' => variable_get('party_user_party_delete_action', 'disallow'),
    '#options' => array(
      'disallow' => 'Disallow the deletion of Parties with attached users',
      'user_cancel_reassign' => 'Delete the account and make its content belong to the Anonymous user',
      'user_cancel_delete' => 'Delete the account and its content',
    ),
    '#description' => t('When a party is deleted what should be done with the attached user entities?'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Save configuration',
    '#weight' => 40,
  );
  return $form;
}