You are here

function fbconnect_profile_form_alter in Facebook Connect 5

Implementation of hook_form_alter().

File

modules/fbconnect_profile/fbconnect_profile.module, line 99
This module allows users to import their personal information from Facebook.

Code

function fbconnect_profile_form_alter($form_id, &$form) {
  if ($form_id == 'fbconnect_admin_settings') {
    $form['import'] = array(
      '#type' => 'fieldset',
      '#title' => t('Facebook profile settings'),
      '#collapsible' => TRUE,
      '#weight' => -1,
    );
    $form['import']['fbconnect_profile_fields'] = array(
      '#type' => 'checkboxes',
      '#options' => variable_get('facebook_user_fields', NULL),
      '#default_value' => variable_get('fbconnect_profile_fields', array_keys(variable_get('facebook_user_fields', NULL))),
    );
  }
  if ($form_id == 'fbconnect_user_settings_form') {
    if ($fbuid = fbconnect_get_fbuid()) {
      $form['import'] = array(
        '#type' => 'fieldset',
        '#collapsible' => FALSE,
        '#weight' => -1,
      );
      $user = user_load(array(
        'uid' => arg(1),
      ));
      $default = (array) fbconnect_profile_get_user_import_setting($user->uid);
      $options = fbconnect_profile_available_import($fbuid);
      $form['import']['import_setting'] = array(
        '#type' => 'checkboxes',
        '#description' => t('This information is displayed on my profile.'),
        '#options' => $options,
        '#default_value' => $default,
      );
      $form['#submit']['fbconnect_profile_user_settings_submit'] = array();
    }
  }
}