From 0e6221a192c704231405ae79cf924cdb3bc76f39 Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Wed, 5 May 2004 21:17:25 +0000
Subject: [PATCH] - Patch #7585 by Gerhard: extra data added by profile.module
 to the user   object got saved in the user's data column even if there is a
 dedicated   table for that information.

---
 modules/profile.module         | 6 +++---
 modules/profile/profile.module | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/profile.module b/modules/profile.module
index 0334445c84c6..b97d9b09322c 100644
--- a/modules/profile.module
+++ b/modules/profile.module
@@ -87,13 +87,13 @@ function profile_load_profile(&$user) {
   }
 }
 
-function profile_save_profile($edit, $user) {
+function profile_save_profile(&$edit, &$user) {
   db_query('DELETE FROM {profile_values} WHERE uid = %d', $user->uid);
   $result = db_query('SELECT fid, name FROM {profile_fields}');
   while ($field = db_fetch_object($result)) {
     if ($edit[$field->name]) {
       db_query("INSERT INTO {profile_values} (fid, uid, value) VALUES (%d, %d, '%s')", $field->fid, $user->uid, $edit[$field->name]);
-      unset($edit[$field->name]);
+      unset($edit[$field->name], $user->{$field->name});
     }
   }
 }
@@ -194,7 +194,7 @@ function profile_validate_profile($edit) {
   return $edit;
 }
 
-function profile_user($type, $edit, &$user) {
+function profile_user($type, &$edit, &$user) {
   switch ($type) {
     case 'load':
       return profile_load_profile($user);
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index 0334445c84c6..b97d9b09322c 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -87,13 +87,13 @@ function profile_load_profile(&$user) {
   }
 }
 
-function profile_save_profile($edit, $user) {
+function profile_save_profile(&$edit, &$user) {
   db_query('DELETE FROM {profile_values} WHERE uid = %d', $user->uid);
   $result = db_query('SELECT fid, name FROM {profile_fields}');
   while ($field = db_fetch_object($result)) {
     if ($edit[$field->name]) {
       db_query("INSERT INTO {profile_values} (fid, uid, value) VALUES (%d, %d, '%s')", $field->fid, $user->uid, $edit[$field->name]);
-      unset($edit[$field->name]);
+      unset($edit[$field->name], $user->{$field->name});
     }
   }
 }
@@ -194,7 +194,7 @@ function profile_validate_profile($edit) {
   return $edit;
 }
 
-function profile_user($type, $edit, &$user) {
+function profile_user($type, &$edit, &$user) {
   switch ($type) {
     case 'load':
       return profile_load_profile($user);
-- 
GitLab