From 554e8f7fedab096467b2d08e8a6f67910267c69d Mon Sep 17 00:00:00 2001 From: ben Date: Sat, 16 Aug 2008 12:32:40 +0000 Subject: Individual profile items can now have access restrictions; also made the profile JS more cache friendly git-svn-id: https://code.elgg.org/elgg/trunk@1968 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/profile/actions/edit.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'mod/profile/actions/edit.php') diff --git a/mod/profile/actions/edit.php b/mod/profile/actions/edit.php index 46b7897df..c3673e4e6 100644 --- a/mod/profile/actions/edit.php +++ b/mod/profile/actions/edit.php @@ -15,8 +15,12 @@ // Get profile fields $input = array(); + $accesslevel = get_input('accesslevel'); + if (!is_array($accesslevel)) $accesslevel = array(); + foreach($CONFIG->profile as $shortname => $valuetype) { $input[$shortname] = get_input($shortname); + if ($valuetype == 'tags') $input[$shortname] = string_to_tag_array($input[$shortname]); } @@ -34,7 +38,22 @@ // Save stuff if (sizeof($input) > 0) foreach($input as $shortname => $value) { - $user->$shortname = $value; + + //$user->$shortname = $value; + remove_metadata($user->guid, $shortname); + if (isset($accesslevel[$shortname])) { + $access_id = (int) $accesslevel[$shortname]; + } else { + $access_id = 0; + } + if (is_array($value)) { + foreach($value as $interval) { + create_metadata($user->guid, $shortname, $interval, 'text', $user->guid, $access_id, true); + } + } else { + create_metadata($user->guid, $shortname, $value, 'text', $user->guid, $access_id); + } + } $user->save(); -- cgit v1.2.3