Permalink
Browse files

feature(profile): only submitted profile fields are updated

BREAKING CHANGE:
Only profile fields that are passed to the profile/edit action via
$_REQUEST will be updated. Omitted fields will not be cleared as it was
before this change.

fixes #8582
  • Loading branch information...
jdalsem committed Jun 30, 2015
1 parent d95dd38 commit fd7b8e0afc8e4dfadaed4b0fbe8919ccd7e0d27f
Showing with 10 additions and 9 deletions.
  1. +10 −9 actions/profile/edit.php
View
@@ -23,21 +23,22 @@
$accesslevel = array();
}
-/**
- * wrapper for recursive array walk decoding
- */
-function profile_array_decoder(&$v) {
- $v = _elgg_html_decode($v);
-}
-
$profile_fields = elgg_get_config('profile_fields');
foreach ($profile_fields as $shortname => $valuetype) {
+ $value = get_input($shortname);
+
+ if ($value === null) {
+ // only submitted profile fields should be updated
+ continue;
+ }
+
// the decoding is a stop gap to prevent && showing up in profile fields
// because it is escaped on both input (get_input()) and output (view:output/text). see #561 and #1405.
// must decode in utf8 or string corruption occurs. see #1567.
- $value = get_input($shortname);
if (is_array($value)) {
- array_walk_recursive($value, 'profile_array_decoder');
+ array_walk_recursive($value, function(&$v) {
+ $v = _elgg_html_decode($v);
+ });
} else {
$value = _elgg_html_decode($value);
}

0 comments on commit fd7b8e0

Please sign in to comment.