diff --git a/include/identity.php b/include/identity.php index c4134d3e8..feb249ea3 100644 --- a/include/identity.php +++ b/include/identity.php @@ -1312,3 +1312,40 @@ function is_public_profile() { return true; return false; } + +function get_profile_fields_basic() { + $profile_fields_basic = get_config('system','profile_fields_basic'); + if(! $profile_fields_basic) + $profile_fields_basic = array('name','pdesc','gender','dob','address','locality','region','postal_code','country_name','marital','sexual','homepage','hometown','keywords','about','contact'); + +// return $profile_fields_basic; + $x = array(); + if($profile_fields_basic) + foreach($profile_fields_basic as $f) + $x[$f] = 1; + + return $x; + +} + + +function get_profile_fields_advanced() { + $basic = get_profile_fields_basic(); + $profile_fields_advanced = get_config('system','profile_fields_advanced'); + if(! $profile_fields_advanced) + $profile_fields_advanced = array('with','howlong','politic','religion','likes','dislikes','interest','channels','music','book','film','tv','romance','work','education'); + +// return $profile_fields_advanced; + + $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; +} + + diff --git a/mod/profiles.php b/mod/profiles.php index 2062f094f..03e6801d2 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -458,11 +458,17 @@ function profiles_content(&$a) { $o = ''; + if(! local_user()) { notice( t('Permission denied.') . EOL); return; } + require_once('include/identity.php'); + + $profile_fields_basic = get_profile_fields_basic(); + $profile_fields_advanced = get_profile_fields_advanced(); + if((argc() > 1) && (intval(argv(1)))) { $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[1]), @@ -486,6 +492,11 @@ function profiles_content(&$a) { )); $advanced = ((feature_enabled(local_user(),'advanced_profiles')) ? true : false); + if($advanced) + $fields = $profile_fields_advanced; + else + $fields = $profile_fields_basic; + $opt_tpl = get_markup_template("profile-hide_friends.tpl"); $hide_friends = replace_macros($opt_tpl,array( @@ -511,11 +522,12 @@ function profiles_content(&$a) { '$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"), + '$fields' => $fields, '$guid' => $r[0]['profile_guid'], '$banner' => t('Edit Profile Details'), '$submit' => t('Submit'), '$viewprof' => t('View this profile'), - '$editvis' => t('Edit visibility'), + '$editvis' => t('Edit visibility'), '$profpic' => t('Change Profile Photo'), '$cr_prof' => t('Create a new profile using these settings'), '$cl_prof' => t('Clone this profile'), diff --git a/view/tpl/profile_edit.tpl b/view/tpl/profile_edit.tpl index d2a2d7252..838415f80 100755 --- a/view/tpl/profile_edit.tpl +++ b/view/tpl/profile_edit.tpl @@ -27,19 +27,23 @@
+{{if $fields.name}}
+{{/if}} +{{if $fields.pdesc}}
+{{/if}} - +{{if $fields.gender}}
{{if $advanced}} @@ -49,7 +53,9 @@ {{/if}}
+{{/if}} +{{if $fields.dob}}
@@ -57,6 +63,7 @@
+{{/if}} {{$hide_friends}} @@ -65,50 +72,60 @@
- +{{if $fields.address}}
+{{/if}} +{{if $fields.locality}}
+{{/if}} - +{{if $fields.postal_code}}
+{{/if}} - +{{if $fields.region}}
+{{/if}} +{{if $fields.country_name}}
+{{/if}} +{{if $fields.hometown}}
+{{/if}}
+{{if $fields.marital }}
{{if $advanced}} @@ -118,53 +135,61 @@ {{/if}}
+{{if $fields.with}}
+{{/if}} +{{if $fields.howlong}} - +
+{{/if}}
+{{/if}} +{{if $fields.homepage}}
+{{/if}} - -{{if $advanced}} +{{if $fields.sexual}}
{{$sexual}}
+{{/if}} +{{if $fields.politic}}
+{{/if}} +{{if $fields.religion}}
- {{/if}} +{{if $fields.keywords}}
{{$lbl_pubdsc}}
+{{/if}} -
- -
-
+{{if $fields.about}}

{{$lbl_about}} @@ -174,9 +199,9 @@

+{{/if}} - - +{{if $fields.contact}}

{{$lbl_social}} @@ -186,9 +211,10 @@

+{{/if}} -{{if $advanced}} +{{if $fields.interest}}

{{$lbl_hobbies}} @@ -198,8 +224,9 @@

+{{/if}} - +{{if $fields.likes}}

{{$lbl_likes}} @@ -209,8 +236,9 @@

+{{/if}} - +{{if $fields.dislikes}}

{{$lbl_dislikes}} @@ -220,8 +248,9 @@

+{{/if}} - +{{if $fields.channels}}

{{$lbl_channels}} @@ -231,13 +260,9 @@

+{{/if}} -
- -
-
- - +{{if $fields.music}}

{{$lbl_music}} @@ -247,7 +272,9 @@

+{{/if}} +{{if $fields.book}}

{{$lbl_book}} @@ -257,9 +284,9 @@

+{{/if}} - - +{{if $fields.tv}}

{{$lbl_tv}} @@ -269,9 +296,9 @@

+{{/if}} - - +{{if $fields.film}}

{{$lbl_film}} @@ -281,14 +308,10 @@

+{{/if}} -
- -
-
- - +{{if $fields.romance}}

{{$lbl_love}} @@ -298,9 +321,9 @@

+{{/if}} - - +{{if $fields.work}}

{{$lbl_work}} @@ -310,9 +333,9 @@

+{{/if}} - - +{{if $fields.education}}

{{$lbl_school}} @@ -322,9 +345,9 @@

- {{/if}} +