From 39cb9bf31c55a6015b7a6442fe65d4e92760b218 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Sun, 6 Feb 2011 21:46:27 +0100 Subject: [PATCH] Do not store profile modification of null fields. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- modules/profile/page.inc.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/profile/page.inc.php b/modules/profile/page.inc.php index 9501b58..1323e86 100644 --- a/modules/profile/page.inc.php +++ b/modules/profile/page.inc.php @@ -306,12 +306,14 @@ abstract class ProfilePage implements PlWizardPage $user = S::user(); if ($owner->isActive()) { foreach ($changedFields as $field => $values) { - XDB::execute('INSERT INTO profile_modifications (pid, uid, field, oldText, newText, type, timestamp) - VALUES ({?}, {?}, {?}, {?}, {?}, {?}, NOW()) - ON DUPLICATE KEY UPDATE uid = VALUES(uid), oldText = IF(VALUES(type) != type, VALUES(oldText), oldText), - newText = VALUES(newText), type = VALUES(type), timestamp = NOW()', - $this->pid(), $user->id(), Profile::$descriptions[$field], $values[0], $values[1], - ($owner->id() == $user->id()) ? 'self' : 'third_party'); + if (!is_null($field)) { + XDB::execute('INSERT INTO profile_modifications (pid, uid, field, oldText, newText, type, timestamp) + VALUES ({?}, {?}, {?}, {?}, {?}, {?}, NOW()) + ON DUPLICATE KEY UPDATE uid = VALUES(uid), oldText = IF(VALUES(type) != type, VALUES(oldText), oldText), + newText = VALUES(newText), type = VALUES(type), timestamp = NOW()', + $this->pid(), $user->id(), Profile::$descriptions[$field], $values[0], $values[1], + ($owner->id() == $user->id()) ? 'self' : 'third_party'); + } } } return true; -- 2.1.4