function fb_user_get_local_user_by_email($fbu) {
global $_fb;
if (isset($_fb) && $fbu) {
- $info = $_fb->api($fbu);
- if (isset($info['email']) &&
- ($email = $info['email'])) {
- return user_load(array('mail' => $email));
+ try {
+ $info = $_fb->api($fbu);
+ if (isset($info['email']) &&
+ ($email = $info['email'])) {
+ return user_load(array('mail' => $email));
+ }
+ }
+ catch (Exception $e) {
+ // This can occur when user logs out of facebook in another window, then returns to our site.
+ if (fb_verbose()) {
+ fb_log_exception($e, t('Failed to get facebook user email.'));
+ }
}
}
}