You are here

function fb_user_user_insert in Drupal for Facebook 7.3

Implements hook_user_insert.

When user is created create record in fb_user to map local Drupal user to FB user.

File

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

Code

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

  // 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.
    if ($account->uid == $user->uid) {
      _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)
  }
}