From c28b18a3797bad3e462e7779a93309464bea3b9d Mon Sep 17 00:00:00 2001
From: mrded <dmitry@demenchuk.me>
Date: Wed, 4 Dec 2013 15:33:27 +0000
Subject: [PATCH] Users with empty mail field.

---
 includes/fboauth.fboauth.inc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/includes/fboauth.fboauth.inc b/includes/fboauth.fboauth.inc
index cc4b87e..7127a10 100644
--- a/includes/fboauth.fboauth.inc
+++ b/includes/fboauth.fboauth.inc
@@ -180,11 +180,14 @@ function fboauth_create_user($fbuser, $options = array()) {
     $username = $username . $i;
   }
 
+  $facebook_mail = isset($fbuser->username) ? $fbuser->username : $fbuser->id;
+  $facebook_mail .= '@facebook.com';
+
   // Initialize basic properties that are unlikely to need changing.
   $edit = array(
     'name' => $username,
-    'mail' => !empty($fbuser->email) ? $fbuser->email : '',
-    'init' => !empty($fbuser->email) ? $fbuser->email : '',
+    'mail' => !empty($fbuser->email) ? $fbuser->email : $facebook_mail,
+    'init' => !empty($fbuser->email) ? $fbuser->email : $facebook_mail,
     // If user_register is "1", then no approval required.
     'status' => $options['status'],
     'timezone' => variable_get('date_default_timezone'), // TODO: is this appropriate in sites with no default?
-- 
1.8.3.4 (Apple Git-47)

