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}}{{$lbl_about}} @@ -174,9 +199,9 @@
{{$lbl_social}} @@ -186,9 +211,10 @@
{{$lbl_hobbies}} @@ -198,8 +224,9 @@
{{$lbl_likes}} @@ -209,8 +236,9 @@
{{$lbl_dislikes}} @@ -220,8 +248,9 @@
{{$lbl_channels}} @@ -231,13 +260,9 @@
{{$lbl_music}} @@ -247,7 +272,9 @@
{{$lbl_book}} @@ -257,9 +284,9 @@
{{$lbl_tv}} @@ -269,9 +296,9 @@
{{$lbl_film}} @@ -281,14 +308,10 @@
{{$lbl_love}} @@ -298,9 +321,9 @@
{{$lbl_work}} @@ -310,9 +333,9 @@
{{$lbl_school}} @@ -322,9 +345,9 @@