aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-08-28 22:18:11 -0700
committerfriendica <info@friendica.com>2014-08-28 22:18:11 -0700
commitfeddf5d7fb1d0cecbad69ecd314af0d106c0a9be (patch)
treec87f25b8996db82dd3b4be316caa5c8237e12d8e /mod
parent8a62b824f98ca55c94a2fc04afbea0c118d44486 (diff)
downloadvolse-hubzilla-feddf5d7fb1d0cecbad69ecd314af0d106c0a9be.tar.gz
volse-hubzilla-feddf5d7fb1d0cecbad69ecd314af0d106c0a9be.tar.bz2
volse-hubzilla-feddf5d7fb1d0cecbad69ecd314af0d106c0a9be.zip
fix saving of extended profile attributes
Diffstat (limited to 'mod')
-rw-r--r--mod/profiles.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/mod/profiles.php b/mod/profiles.php
index d6df09e9a..1504f55f0 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -254,6 +254,7 @@ function profiles_post(&$a) {
// $month = 1; $day = 1;
// }
+
$dob = '0000-00-00';
$dob = sprintf('%04d-%02d-%02d',$year,$month,$day);
@@ -264,6 +265,9 @@ function profiles_post(&$a) {
$namechanged = true;
+
+
+
$pdesc = escape_tags(trim($_POST['pdesc']));
$gender = escape_tags(trim($_POST['gender']));
$address = escape_tags(trim($_POST['address']));
@@ -344,7 +348,41 @@ function profiles_post(&$a) {
$with = $orig[0]['with'];
}
+ $profile_fields_basic = get_profile_fields_basic();
+ $profile_fields_advanced = get_profile_fields_advanced();
+ $advanced = ((feature_enabled(local_user(),'advanced_profiles')) ? true : false);
+ if($advanced)
+ $fields = $profile_fields_advanced;
+ else
+ $fields = $profile_fields_basic;
+ $z = q("select * from profdef where true");
+ if($z) {
+ foreach($z as $zz) {
+ if(array_key_exists($zz['field_name'],$fields)) {
+ $w = q("select * from profext where channel_id = %d and hash = '%s' and k = '%s' limit 1",
+ intval(local_user()),
+ dbesc($orig[0]['profile_guid']),
+ dbesc($zz['field_name'])
+ );
+ if($w) {
+ q("update profext set v = '%s' where id = %d limit 1",
+ dbesc(escape_tags(trim($_POST[$zz['field_name']]))),
+ intval($w[0]['id'])
+ );
+ }
+ else {
+ q("insert into profdef ( channel_id, hash, k, v ) values ( %d, '%s', '%s', '%s') ",
+ intval(local_user()),
+ dbesc($orig[0]['profile_guid']),
+ dbesc($zz['field_name']),
+ dbesc(escape_tags(trim($_POST[$zz['field_name']])))
+ );
+ }
+ }
+ }
+ }
+
$changes = array();