aboutsummaryrefslogtreecommitdiffstats
path: root/include/identity.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/identity.php')
-rw-r--r--include/identity.php78
1 files changed, 77 insertions, 1 deletions
diff --git a/include/identity.php b/include/identity.php
index e210b37ab..9335673a0 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -559,6 +559,37 @@ function profile_load(&$a, $nickname, $profile = '') {
return;
}
+ $q = q("select * from profext where hash = '%s' and channel_id = %d",
+ dbesc($p[0]['profile_guid']),
+ intval($p[0]['profile_uid'])
+ );
+ if($q) {
+
+ $extra_fields = array();
+
+ require_once('include/identity.php');
+ $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;
+
+ foreach($q as $qq) {
+ foreach($fields as $k => $f) {
+ if($k == $qq['k']) {
+ $p[0][$k] = $qq['v'];
+ $extra_fields[] = $k;
+ break;
+ }
+ }
+ }
+ }
+
+ $p[0]['extra_fields'] = $extra_fields;
+
$z = q("select xchan_photo_date from xchan where xchan_hash = '%s' limit 1",
dbesc($p[0]['channel_hash'])
);
@@ -952,7 +983,7 @@ function advanced_profile(&$a) {
if($a->profile['gender']) $profile['gender'] = array( t('Gender:'), $a->profile['gender'] );
$ob_hash = get_observer_hash();
- if($ob_hash && perm_is_allowed($a->profile['profile_uid'],$ob_hash,'post_wall')) {
+ if($ob_hash && perm_is_allowed($a->profile['profile_uid'],$ob_hash,'post_like')) {
$profile['canlike'] = true;
$profile['likethis'] = t('Like this channel');
$profile['profile_guid'] = $a->profile['profile_guid'];
@@ -1041,6 +1072,16 @@ function advanced_profile(&$a) {
if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt );
+ if($a->profile['extra_fields']) {
+ foreach($a->profile['extra_fields'] as $f) {
+ $x = q("select * from profdef where field_name = '%s' limit 1",
+ dbesc($f)
+ );
+ if($x && $txt = prepare_text($a->profile[$f]))
+ $profile[$f] = array( $x[0]['field_desc'] . ':',$txt);
+ }
+ $profile['extra_fields'] = $a->profile['extra_fields'];
+ }
$things = get_things($a->profile['profile_guid'],$a->profile['profile_uid']);
@@ -1312,3 +1353,38 @@ function is_public_profile() {
return true;
return false;
}
+
+function get_profile_fields_basic($filter = 0) {
+
+ $profile_fields_basic = (($filter == 0) ? get_config('system','profile_fields_basic') : null);
+ if(! $profile_fields_basic)
+ $profile_fields_basic = array('name','pdesc','chandesc','gender','dob','dob_tz','address','locality','region','postal_code','country_name','marital','sexual','homepage','hometown','keywords','about','contact');
+
+ $x = array();
+ if($profile_fields_basic)
+ foreach($profile_fields_basic as $f)
+ $x[$f] = 1;
+
+ return $x;
+
+}
+
+
+function get_profile_fields_advanced($filter = 0) {
+ $basic = get_profile_fields_basic($filter);
+ $profile_fields_advanced = (($filter == 0) ? get_config('system','profile_fields_advanced') : null);
+ if(! $profile_fields_advanced)
+ $profile_fields_advanced = array('with','howlong','politic','religion','likes','dislikes','interest','channels','music','book','film','tv','romance','work','education');
+
+ $x = array();
+ if($basic)
+ foreach($basic as $f => $v)
+ $x[$f] = $v;
+ if($profile_fields_advanced)
+ foreach($profile_fields_advanced as $f)
+ $x[$f] = 1;
+
+ return $x;
+}
+
+