You are here

function _fb_user_create_map in Drupal for Facebook 7.3

Same name and namespace in other branches
  1. 6.3 fb_user.module \_fb_user_create_map()

Create a map linking the facebook account to the currently logged in local user account.

Return value

  • TRUE, if map created.
1 call to _fb_user_create_map()
_fb_user_process_authorized_user in ./fb_user.module
Create local account or account map for a facebook user who has authorized the application.

File

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

Code

function _fb_user_create_map() {
  if ($GLOBALS['user']->uid) {
    $fbu = fb_facebook_user();
    $account = fb_user_get_local_user($fbu);
    if ($fbu && !$account && !fb_controls(FB_USER_CONTROL_NO_CREATE_MAP)) {
      _fb_user_set_map($GLOBALS['user'], $fbu);
      fb_invoke(FB_USER_OP_POST_USER_CONNECT, array(
        'account' => $GLOBALS['user'],
        'fbu' => $fbu,
      ), NULL, 'fb_user');
      return TRUE;
    }
  }
  return FALSE;
}