function fbconnect_login_add_user_afterlogin_submit in Facebook Connect 7.2
Same name and namespace in other branches
- 8.2 fbconnect_login/fbconnect_login.module \fbconnect_login_add_user_afterlogin_submit()
Add the user to the fbconnect_users table if they logged in with Facebook
_state
Parameters
mixed $form:
1 string reference to 'fbconnect_login_add_user_afterlogin_submit'
- fbconnect_login_form_alter in fbconnect_login/
fbconnect_login.module - Implements hook_form_alter().
File
- fbconnect_login/
fbconnect_login.module, line 418 - Login functionality for Facebook Connect module
Code
function fbconnect_login_add_user_afterlogin_submit($form, &$form_state) {
global $user;
$data = fbconnect_get_user_info(array(
'name',
'email',
));
//user not logged into Facebook we dont have any information for them, let them log in again
if (empty($data)) {
module_load_include('inc', 'fbconnect_login', 'fbconnect_login.pages');
return facebook_login_page($form, $form_state);
}
$uid = _email_already_exist($data['email']);
if ($uid == $user->uid) {
//add this user to the fbconnect_users table
fbconnect_login_register($user->uid, $data['id']);
}
else {
drupal_set_message(t('You have logged into the website with an account that does not have the same email as your Facebook account.'));
}
}