function party_user_settings_form in Party 8.2
Same name and namespace in other branches
- 7 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
$data_sets = party_get_data_set_info();
$options = array();
foreach ($data_sets as $data_set => $data_set_info) {
$fields = field_info_instances($data_set_info['entity type'], $data_set_info['entity bundle']);
foreach ($fields as $field => $field_info) {
if ($field_info['widget']['type'] == 'text_textfield') {
$options["{$data_set}:{$field}"] = t('@data_set_label - @label [%field_name]', array(
'@label' => $field_info['label'],
'@data_set_label' => $data_set_info['label'],
'%field_name' => $field,
));
}
}
}
$form['email_sync'] = array(
'#type' => 'checkboxes',
'#options' => $options,
'#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()),
);
$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;
}