aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/profile/actions/edit.php21
-rw-r--r--mod/profile/start.php12
-rw-r--r--mod/profile/views/default/profile/edit.php23
-rw-r--r--mod/profile/views/default/profile/javascript.php2
-rw-r--r--mod/profile/views/default/profile/metatags.php2
5 files changed, 55 insertions, 5 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();
diff --git a/mod/profile/start.php b/mod/profile/start.php
index b26abb93f..9ad88fab6 100644
--- a/mod/profile/start.php
+++ b/mod/profile/start.php
@@ -44,6 +44,7 @@
// Register a page handler, so we can have nice URLs
register_page_handler('profile','profile_page_handler');
register_page_handler('icon','profile_icon_handler');
+ register_page_handler('iconjs','profile_iconjs_handler');
// Add Javascript reference to the page header
extend_view('metatags','profile/metatags');
@@ -104,6 +105,17 @@
}
/**
+ * Icon JS
+ */
+ function profile_iconjs_handler($page) {
+
+ global $CONFIG;
+
+ include($CONFIG->pluginspath . "profile/javascript.php");
+
+ }
+
+ /**
* Profile URL generator for $user->getUrl();
*
* @param ElggUser $user
diff --git a/mod/profile/views/default/profile/edit.php b/mod/profile/views/default/profile/edit.php
index ea0a307fc..5d409140d 100644
--- a/mod/profile/views/default/profile/edit.php
+++ b/mod/profile/views/default/profile/edit.php
@@ -22,7 +22,23 @@
//var_export($vars['profile']);
if (is_array($vars['config']->profile) && sizeof($vars['config']->profile) > 0)
foreach($vars['config']->profile as $shortname => $valtype) {
-
+ if ($metadata = get_metadata_byname($vars['entity']->guid, $shortname)) {
+ if (is_array($metadata)) {
+ $value = '';
+ foreach($metadata as $md) {
+ if (!empty($value)) $value .= ', ';
+ $value .= $md->value;
+ $access_id = $md->access_id;
+ }
+ } else {
+ $value = $metadata->value;
+ $access_id = $metadata->access_id;
+ }
+ } else {
+ $value = '';
+ $access_id = 1;
+ }
+
?>
<p>
@@ -30,13 +46,14 @@
<?php echo elgg_echo("profile:{$shortname}") ?><br />
<?php echo elgg_view("input/{$valtype}",array(
'internalname' => $shortname,
- 'value' => $vars['entity']->$shortname,
+ 'value' => $value,
)); ?>
</label>
+ <?php echo elgg_view('input/access',array('internalname' => 'accesslevel['.$shortname.']', 'value' => $access_id)); ?>
</p>
<?php
-
+
}
?>
diff --git a/mod/profile/views/default/profile/javascript.php b/mod/profile/views/default/profile/javascript.php
index e0f87522c..2620956b3 100644
--- a/mod/profile/views/default/profile/javascript.php
+++ b/mod/profile/views/default/profile/javascript.php
@@ -13,6 +13,8 @@
*/
header("Content-type: text/javascript");
+ header("Pragma: public");
+ header("Cache-Control: public");
?>
diff --git a/mod/profile/views/default/profile/metatags.php b/mod/profile/views/default/profile/metatags.php
index 84682f6f6..3a58651ca 100644
--- a/mod/profile/views/default/profile/metatags.php
+++ b/mod/profile/views/default/profile/metatags.php
@@ -13,4 +13,4 @@
?>
- <script type="text/javascript" src="<?php echo $vars['url']; ?>mod/profile/javascript.php" ></script>
+ <script type="text/javascript" src="<?php echo $vars['url']; ?>pg/iconjs/profile.js" ></script>