aboutsummaryrefslogtreecommitdiff
path: root/mod/profile/actions/edit.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/profile/actions/edit.php')
-rw-r--r--mod/profile/actions/edit.php21
1 files changed, 20 insertions, 1 deletions
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();