aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-08-13 22:22:52 -0700
committerfriendica <info@friendica.com>2014-08-13 22:22:52 -0700
commit1d6f49493674a8e9423f509eddea62f97c417ba5 (patch)
tree558ee91f724e2df3c2e2354b30f5db233f800fe2
parent4156c68d0d433e804787cdd7ff52235d51b53ba2 (diff)
downloadvolse-hubzilla-1d6f49493674a8e9423f509eddea62f97c417ba5.tar.gz
volse-hubzilla-1d6f49493674a8e9423f509eddea62f97c417ba5.tar.bz2
volse-hubzilla-1d6f49493674a8e9423f509eddea62f97c417ba5.zip
some work on extended profile fields
-rw-r--r--include/identity.php41
-rw-r--r--mod/admin.php23
-rwxr-xr-xview/tpl/profile_advanced.tpl10
3 files changed, 74 insertions, 0 deletions
diff --git a/include/identity.php b/include/identity.php
index 643961465..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'])
);
@@ -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']);
diff --git a/mod/admin.php b/mod/admin.php
index 464edddd4..9f756c2d2 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -65,6 +65,11 @@ function admin_post(&$a){
case 'dbsync':
admin_page_dbsync_post($a);
break;
+
+ case 'profs':
+ admin_page_profs_post($a);
+ break;
+
}
}
@@ -95,6 +100,7 @@ function admin_content(&$a) {
'plugins' => Array($a->get_baseurl(true)."/admin/plugins/", t("Plugins") , "plugins"),
'themes' => Array($a->get_baseurl(true)."/admin/themes/", t("Themes") , "themes"),
'hubloc' => Array($a->get_baseurl(true)."/admin/hubloc/", t("Server") , "server"),
+ 'profs' => array(z_root() . '/admin/profs', t('Profile Config'), 'profs'),
'dbsync' => Array($a->get_baseurl(true)."/admin/dbsync/", t('DB updates'), "dbsync")
);
@@ -155,6 +161,9 @@ function admin_content(&$a) {
case 'dbsync':
$o = admin_page_dbsync($a);
break;
+ case 'profs':
+ $o = admin_page_profs($a);
+ break;
default:
notice( t("Item not found.") );
}
@@ -1317,3 +1326,17 @@ readable.");
));
}
+function admin_page_profs_post(&$a) {
+
+
+}
+
+function admin_page_profs(&$a) {
+
+
+}
+
+
+
+
+
diff --git a/view/tpl/profile_advanced.tpl b/view/tpl/profile_advanced.tpl
index 73033fe40..cbb078710 100755
--- a/view/tpl/profile_advanced.tpl
+++ b/view/tpl/profile_advanced.tpl
@@ -193,6 +193,16 @@
</dl>
{{/if}}
+{{foreach $profile.extra_fields as $f}}
+{{if $profile.$f}}
+<dl id="aprofile-{{$f}}" class="aprofile">
+ <dt>{{$profile.$f.0}}</dt>
+ <dd>{{$profile.$f.1}}</dd>
+</dl>
+{{/if}}
+{{/foreach}}
+
+
{{if $things}}
{{foreach $things as $key => $items}}
<b>{{$profile.fullname.1}} {{$key}}</b>