You are here

function fboauth_profile_form_alter in Facebook OAuth (FBOAuth) 7

Same name and namespace in other branches
  1. 6 includes/fboauth.profile.inc \fboauth_profile_form_alter()
  2. 7.2 includes/fboauth.profile.inc \fboauth_profile_form_alter()

Add options for Profile module to the Facebook OAuth settings form.

1 call to fboauth_profile_form_alter()
fboauth_settings_form in includes/fboauth.pages.inc
Menu callback; Display the settings form for Facebook OAuth.

File

includes/fboauth.profile.inc, line 39
Functions to assist with handling with Profile module data.

Code

function fboauth_profile_form_alter(&$form, &$form_state) {
  $form['fboauth_user_profile'] = array(
    '#type' => 'fieldset',
    '#title' => t('Profile field mapping'),
    '#description' => t('Each of your Profile fields are listed below. Map each one you would like to import into your site to a Facebook data source. <strong>Note that only profile fields configured to show on the user registration form may be imported!</strong>'),
    '#tree' => TRUE,
    '#weight' => 5,
  );
  $properties = fboauth_user_properties(TRUE);
  $property_options = array(
    '' => t('- Do not import -'),
  );
  foreach ($properties as $property => $property_info) {
    $property_options[$property] = '[' . $property . '] ' . $property_info['label'];
  }
  $field_defaults = variable_get('fboauth_user_profile', array());
  $field_select = array(
    '#type' => 'select',
    '#options' => $property_options,
  );
  $profile_fields = fboauth_profile_fields();
  foreach ($profile_fields as $profile_name => $profile_field) {
    $form['fboauth_user_profile'][$profile_name] = $field_select;
    $form['fboauth_user_profile'][$profile_name]['#title'] = t($profile_field['title']);
    $form['fboauth_user_profile'][$profile_name]['#default_value'] = isset($field_defaults[$profile_name]) ? $field_defaults[$profile_name] : '';
  }
}