You are here

function pcp_admin_settings_form in Profile Complete Percent 6.2

Same name and namespace in other branches
  1. 5 pcp.module \pcp_admin_settings_form()
  2. 6 pcp.module \pcp_admin_settings_form()

Admin settings form

1 string reference to 'pcp_admin_settings_form'
pcp_admin_settings in ./pcp.module
Menu Callback Function Build output of the pcp module settings which allows the administrator to tag specific profile fields which will be used to determine the completion of a users profile.

File

./pcp.module, line 162
Allows users with valid permissions to tag profile fields created from the profile module as required fields for a users profile to be considered complete.

Code

function pcp_admin_settings_form() {
  $form = array();
  $form['general_settings'] = array(
    '#type' => 'fieldset',
    '#title' => 'General Settings',
  );
  $form['general_settings']['hide_block_on_complete'] = array(
    '#type' => 'checkbox',
    '#title' => 'Hide Block When Complete',
    '#default_value' => variable_get('pcp_hide_block_on_complete', 0),
    '#description' => t('When a user reaches 100% complete of their profile, do you want the profile complete percent block to go away? If so, check this box on.'),
  );
  $form['profile_field_settings'] = array(
    '#type' => 'fieldset',
    '#title' => 'Profile Fields',
    '#description' => t('Checking a profile field below will add that field to the logic of the complete percentage.'),
  );

  // Add user picture support
  if (variable_get('user_pictures', 0)) {
    $form['profile_field_settings']['pcp_enable_user_picture'] = array(
      '#title' => 'Enable User Picture Support',
      '#type' => 'checkbox',
      '#default_value' => variable_get('pcp_enable_user_picture', 0),
      '#description' => t('Picture support has been turned on, do you want to make it required as part of Profile Complete Percent? Checking this box will make it required.'),
    );
  }
  $options = pcp_admin_settings_form_data();
  if ($options['profile_fields_options']) {
    $form['profile_field_settings']['profile_fields'] = array(
      '#title' => t('Profile Fields'),
      '#type' => 'checkboxes',
      '#options' => $options['profile_fields_options'],
      '#default_value' => $options['default_values'],
    );
  }

  // Add user terms support
  if (module_exists('user_terms')) {
    $vocabs = taxonomy_get_vocabularies();
    $vocabs_enabled = variable_get('user_terms_vocabs', array());
    $all_vocabs = array();
    foreach ($vocabs_enabled as $vid) {
      $all_vocabs[$vid] = $vocabs[$vid]->name;
    }
    if (!empty($vocabs_enabled)) {
      $form['profile_field_settings']['pcp_enabled_user_terms_vocabs'] = array(
        '#title' => t('User Terms Vocabularies'),
        '#type' => 'checkboxes',
        '#options' => $all_vocabs,
        '#default_value' => variable_get('pcp_enabled_user_terms_vocabs', array()),
      );
    }
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}