+ S::logger()->log('profil', $platal->pl_self(2));
+
+ /** Stores all profile modifications for active users in order to:
+ * -daily notify the user in case of third party edition,
+ * -display the modification to the secretaries for verification in
+ * case of an edition made by the user.
+ */
+ $owner = $this->profile->owner();
+ $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');
+ }
+ }
+ return true;