You are here

function fb_user_user_login in Drupal for Facebook 7.3

Same name and namespace in other branches
  1. 7.4 fb_user.module \fb_user_user_login()

Implements hook_user_login.

Map local Drupal user to FB user under certain circumstances.

File

./fb_user.module, line 699
This module manages relations between local Drupal user accounts and their accounts on facebook.com.

Code

function fb_user_user_login(&$edit, $account) {
  global $user, $_fb_app;

  // A facebook user has logged in. We can map the two accounts together.
  $fb_user_data = _fb_user_get_config($_fb_app);
  if (($fbu = fb_facebook_user()) && $fb_user_data['map_account'][FB_USER_OPTION_MAP_ALWAYS] && !fb_controls(FB_USER_CONTROL_NO_CREATE_MAP)) {

    // Create fb_user record if it doesn't exist or update existing one
    _fb_user_set_map($account, $fbu);

    // @TODO - if the app has a role, make sure the user gets that role. (presently,
    // that will not happen until their next request)
  }
}