From ca21b0af81e7e0fe5da0755f95910ab112a5f3b9 Mon Sep 17 00:00:00 2001
From: James Williams <james.williams@computerminds.co.uk>
Date: Tue, 20 Sep 2011 12:07:49 +0100
Subject: [PATCH] Issue #1117214 by alasda, james.williams: Fixed PHP notice on saving account.

---
 fb_user.module |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/fb_user.module b/fb_user.module
index b485217..accb0d9 100644
--- a/fb_user.module
+++ b/fb_user.module
@@ -675,16 +675,18 @@ function fb_user_user_view($account, $view_mode, $langcode) {
  * User is about to be updated.
  */
 function fb_user_user_update(&$edit, $account, $category) {
-  if ($edit['map']) {
-    _fb_user_set_map($account, $edit['map']);
-  }
-  else {
-    // Delete account mapping, because administrator has unchecked the connect option.
-    $num_deleted = db_delete('fb_user')
-      ->condition('uid', $account->uid)
-      ->execute();
+  if (!empty($edit['name'])) {
+    if (!empty($edit['map'])) {
+      _fb_user_set_map($account, $edit['map']);
+    }
+    else {
+      // Delete account mapping, because administrator has unchecked the connect option.
+      $num_deleted = db_delete('fb_user')
+        ->condition('uid', $account->uid)
+        ->execute();
 
-    fb_invoke(FB_USER_OP_POST_USER_DISCONNECT, array('account' => $account), NULL, 'fb_user');
+      fb_invoke(FB_USER_OP_POST_USER_DISCONNECT, array('account' => $account), NULL, 'fb_user');
+    }
   }
 }
 
-- 
1.7.1

