You are here

function _fb_user_create_map_by_email in Drupal for Facebook 7.3

Same name and namespace in other branches
  1. 6.3 fb_user.module \_fb_user_create_map_by_email()
1 call to _fb_user_create_map_by_email()
_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 405
This module manages relations between local Drupal user accounts and their accounts on facebook.com.

Code

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