You are here

function fbconnect_login_user_settings_form in Facebook Connect 7.2

Same name and namespace in other branches
  1. 8.2 fbconnect_login/fbconnect_login.pages.inc \fbconnect_login_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_login_user_settings_form'
fbconnect_login_user_identities in fbconnect_login/fbconnect_login.pages.inc
Menu callback fbconnect identities

File

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

Code

function fbconnect_login_user_settings_form($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->data['fb_visible']) ? $account->data['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'),
      '#description' => t('Your picture will be loaded from Facebook.'),
      '#default_value' => isset($account->data['fb_avatar']) ? $account->data['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/config/people/accounts'),
    ));
  }
  $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'),
    '#markup' => '<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' => !!facebook_client_session(),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save settings'),
  );
  return $form;
}