You are here

function fbconnect_login_user_identities in Facebook Connect 7.2

Same name and namespace in other branches
  1. 8.2 fbconnect_login/fbconnect_login.pages.inc \fbconnect_login_user_identities()

Menu callback fbconnect identities

1 string reference to 'fbconnect_login_user_identities'
fbconnect_login_menu_alter in fbconnect_login/fbconnect_login.module
Implements hook_menu_alter().

File

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

Code

function fbconnect_login_user_identities($form_id, $account) {
  $conf = fbconnect_get_config();
  $current_fbuid = fbconnect_get_fbuid();

  // fbuid of currently logged in FB user
  $fbuid = _get_user_fbuid($account->uid);

  // fbuid of account being edited
  drupal_set_title(check_plain($account->name));
  $uid = NULL;
  if ($fbuid) {
    $uid = _is_fbconnect_user($fbuid);
    $account->fbuid = $fbuid;
  }
  if (!$uid && !empty($current_fbuid)) {

    // We have Facebook access for this user but we dont have the user in the fbconnect_users table, add him.
    fbconnect_login_register($account->uid, $current_fbuid);
    $uid = _is_fbconnect_user($current_fbuid);
  }
  if (isset($account->fbuid) && $account->fbuid) {
    return drupal_get_form('fbconnect_login_user_settings_form', $account);
  }
  elseif ($uid && $account->uid != $uid) {
    return theme('fbconnect_login_user_profile_tab_connected', array(
      'account' => $account,
      'conf' => $conf,
      'uid' => $uid,
    ));
  }
  else {
    return theme('fbconnect_login_user_profile_tab_unconnected', array(
      'account' => $account,
      'conf' => $conf,
      'uid' => $uid,
    ));
  }
}