You are here

function fbconnect_user_settings_form in Facebook Connect 5

Same name and namespace in other branches
  1. 6.2 fbconnect.pages.inc \fbconnect_user_settings_form()
  2. 6 fbconnect.pages.inc \fbconnect_user_settings_form()

This form allows the user to manage their facebook connect settings.

Some options are visible only if facebook session is active.

2 string references to 'fbconnect_user_settings_form'
fbconnect_profile_form_alter in modules/fbconnect_profile/fbconnect_profile.module
Implementation of hook_form_alter().
fbconnect_user_identities in ./fbconnect.module
Menu callback fbconnect identities

File

./fbconnect.module, line 428
This module allows site visitors to connect and register with facebook account

Code

function fbconnect_user_settings_form() {
  $user = user_load(array(
    'uid' => arg(1),
  ));

  // These fields manage the visibility of the user,
  // if the option is enabled, user's facebook friends
  // will be able to see his presence on this site
  $form['view'] = array(
    '#type' => 'fieldset',
    '#collapsible' => FALSE,
    '#weight' => -2,
  );
  $form['view']['visibility'] = array(
    '#type' => 'checkbox',
    '#title' => t('Let my Facebook friends see me on @sitename', array(
      '@sitename' => variable_get('site_name', 'this website'),
    )),
    '#description' => t('My Facebook friends will be able to see that I own an account on this website.'),
    '#default_value' => $user->fb_visibility,
  );

  // This fields is visible only if we got a active Facebook session.
  // Whether user picture is enabled,
  // users can choose to use his facebook avatar as avatar
  if (fbconnect_get_fbuid()) {
    if (variable_get('user_pictures', 0)) {
      $form['avatar'] = array(
        '#type' => 'fieldset',
        '#collapsible' => FALSE,
        '#weight' => -3,
      );
      $form['avatar']['fb_avatar'] = array(
        '#type' => 'checkbox',
        '#title' => t('Use my Facebook picture on @sitename', array(
          '@sitename' => variable_get('site_name', t('this website')),
        )),
        '#description' => t('Your picture will be updated every 24 hours.'),
        '#default_value' => fbconnect_user_avatar_setting($user->uid),
      );
    }
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save settings'),
  );
  return $form;
}