You are here

function fbconnect_user_settings_form in Facebook Connect 6.2

Same name and namespace in other branches
  1. 5 fbconnect.module \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.

1 string reference to 'fbconnect_user_settings_form'
fbconnect_user_identities in ./fbconnect.pages.inc
Menu callback fbconnect identities

File

./fbconnect.pages.inc, line 199
User pages callbacks for the fbconnect module.

Code

function fbconnect_user_settings_form($form_state, $account) {
  $conf = fbconnect_get_config();

  // 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['fb_visible'] = array(
    '#type' => 'checkbox',
    '#title' => t('Let my Facebook friends see me on @site', array(
      '@site' => $conf['invite_name'],
    )),
    '#description' => t('My Facebook friends will be able to see that I own an account on this website.'),
    '#default_value' => isset($account->fb_visible) ? $account->fb_visible : NULL,
  );

  // Whether user picture is enabled, users can choose to use his facebook
  // avatar as avatar.
  if ($conf['user_pictures'] == 'allow') {
    $form['fb_avatar'] = array(
      '#type' => 'checkbox',
      '#title' => t('Use my Facebook picture as user picture'),
      '#default_value' => isset($account->fb_avatar) ? $account->fb_avatar : NULL,
    );
  }
  if (!variable_get('user_pictures', 0)) {
    $form['fb_avatar']['#attributes'] = array(
      'disabled' => 'disabled',
    );
    $form['fb_avatar']['#description'] = t('Enable user picture support in !link', array(
      '!link' => l(t('User settings'), 'admin/user/settings'),
    ));
  }
  $form['account'] = array(
    '#type' => 'value',
    '#value' => $account,
  );
  $form['fbconnect'] = array(
    '#title' => t('Facebook account'),
    '#type' => 'fieldset',
    '#collapsed' => TRUE,
    '#collapsible' => TRUE,
  );
  $form['fbconnect']['profile'] = array(
    '#type' => 'item',
    '#title' => t('Linked to this Facebook account'),
    '#value' => '<fb:name uid="' . $account->fbuid . '" useyou="false" linked="true"></fb:name>',
  );
  $form['fbconnect']['unlink'] = array(
    '#type' => 'submit',
    '#description' => t('Click here to unlink this Facebook account'),
    '#value' => t('Unlink'),
    '#access' => !!fbconnect_facebook_client(),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save settings'),
  );
  return $form;
}