diff options
-rw-r--r-- | include/identity.php | 37 | ||||
-rw-r--r-- | mod/profiles.php | 14 | ||||
-rwxr-xr-x | view/tpl/profile_edit.tpl | 101 |
3 files changed, 112 insertions, 40 deletions
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 @@ </div> <div id="profile-edit-profile-name-end"></div> +{{if $fields.name}} <div id="profile-edit-name-wrapper" > <label id="profile-edit-name-label" for="profile-edit-name" >{{$lbl_fullname}} </label> <input type="text" size="32" name="name" id="profile-edit-name" value="{{$name}}" /> </div> <div id="profile-edit-name-end"></div> +{{/if}} +{{if $fields.pdesc}} <div id="profile-edit-pdesc-wrapper" > <label id="profile-edit-pdesc-label" for="profile-edit-pdesc" >{{$lbl_title}} </label> <input type="text" size="32" name="pdesc" id="profile-edit-pdesc" value="{{$pdesc}}" /> </div> <div id="profile-edit-pdesc-end"></div> +{{/if}} - +{{if $fields.gender}} <div id="profile-edit-gender-wrapper" > <label id="profile-edit-gender-label" for="gender-select" >{{$lbl_gender}} </label> {{if $advanced}} @@ -49,7 +53,9 @@ {{/if}} </div> <div id="profile-edit-gender-end"></div> +{{/if}} +{{if $fields.dob}} <div id="profile-edit-dob-wrapper" > <label id="profile-edit-dob-label" for="dob-select" >{{$lbl_bd}} </label> <div id="profile-edit-dob" > @@ -57,6 +63,7 @@ </div> </div> <div id="profile-edit-dob-end"></div> +{{/if}} {{$hide_friends}} @@ -65,50 +72,60 @@ </div> <div class="profile-edit-submit-end"></div> - +{{if $fields.address}} <div id="profile-edit-address-wrapper" > <label id="profile-edit-address-label" for="profile-edit-address" >{{$lbl_address}} </label> <input type="text" size="32" name="address" id="profile-edit-address" value="{{$address}}" /> </div> <div id="profile-edit-address-end"></div> +{{/if}} +{{if $fields.locality}} <div id="profile-edit-locality-wrapper" > <label id="profile-edit-locality-label" for="profile-edit-locality" >{{$lbl_city}} </label> <input type="text" size="32" name="locality" id="profile-edit-locality" value="{{$locality}}" /> </div> <div id="profile-edit-locality-end"></div> +{{/if}} - +{{if $fields.postal_code}} <div id="profile-edit-postal-code-wrapper" > <label id="profile-edit-postal-code-label" for="profile-edit-postal-code" >{{$lbl_zip}} </label> <input type="text" size="32" name="postal_code" id="profile-edit-postal-code" value="{{$postal_code}}" /> </div> <div id="profile-edit-postal-code-end"></div> +{{/if}} - +{{if $fields.region}} <div id="profile-edit-region-wrapper" > <label id="profile-edit-region-label" for="profile-edit-region" >{{$lbl_region}} </label> <input type="text" size="32" name="region" id="profile-edit-region" value="{{$region}}" /> </div> <div id="profile-edit-region-end"></div> +{{/if}} +{{if $fields.country_name}} <div id="profile-edit-country-name-wrapper" > <label id="profile-edit-country-name-label" for="profile-edit-country-name" >{{$lbl_country}} </label> <input type="text" size="32" name="country_name" id="profile-edit-country-name" value="{{$country_name}}" /> </div> <div id="profile-edit-country-name-end"></div> +{{/if}} +{{if $fields.hometown}} <div id="profile-edit-hometown-wrapper" > <label id="profile-edit-hometown-label" for="profile-edit-hometown" >{{$lbl_hometown}} </label> <input type="text" size="32" name="hometown" id="profile-edit-hometown" value="{{$hometown}}" /> </div> <div id="profile-edit-hometown-end"></div> +{{/if}} <div class="profile-edit-submit-wrapper" > <input type="submit" name="submit" class="profile-edit-submit-button" value="{{$submit}}" /> </div> <div class="profile-edit-submit-end"></div> +{{if $fields.marital }} <div id="profile-edit-marital-wrapper" > <label id="profile-edit-marital-label" for="profile-edit-marital" >{{$lbl_marital}} </label> {{if $advanced}} @@ -118,53 +135,61 @@ {{/if}} </div> <div class="clear"></div> +{{if $fields.with}} <label id="profile-edit-with-label" for="profile-edit-with" > {{$lbl_with}} </label> <input type="text" size="32" name="with" id="profile-edit-with" title="{{$lbl_ex1}}" value="{{$with}}" /> <div class="clear"></div> +{{/if}} +{{if $fields.howlong}} <label id="profile-edit-howlong-label" for="profile-edit-howlong" > {{$lbl_howlong}} </label> <input type="text" size="32" name="howlong" id="profile-edit-howlong" title="{{$lbl_howlong}}" value="{{$howlong}}" /> - +<div class="clear"></div> +{{/if}} <div id="profile-edit-marital-end"></div> +{{/if}} +{{if $fields.homepage}} <div id="profile-edit-homepage-wrapper" > <label id="profile-edit-homepage-label" for="profile-edit-homepage" >{{$lbl_homepage}} </label> <input type="text" size="32" name="homepage" id="profile-edit-homepage" value="{{$homepage}}" /> </div> <div id="profile-edit-homepage-end"></div> +{{/if}} - -{{if $advanced}} +{{if $fields.sexual}} <div id="profile-edit-sexual-wrapper" > <label id="profile-edit-sexual-label" for="sexual-select" >{{$lbl_sexual}} </label> {{$sexual}} </div> <div id="profile-edit-sexual-end"></div> +{{/if}} +{{if $fields.politic}} <div id="profile-edit-politic-wrapper" > <label id="profile-edit-politic-label" for="profile-edit-politic" >{{$lbl_politic}} </label> <input type="text" size="32" name="politic" id="profile-edit-politic" value="{{$politic}}" /> </div> <div id="profile-edit-politic-end"></div> +{{/if}} +{{if $fields.religion}} <div id="profile-edit-religion-wrapper" > <label id="profile-edit-religion-label" for="profile-edit-religion" >{{$lbl_religion}} </label> <input type="text" size="32" name="religion" id="profile-edit-religion" value="{{$religion}}" /> </div> <div id="profile-edit-religion-end"></div> - {{/if}} +{{if $fields.keywords}} <div id="profile-edit-pubkeywords-wrapper" > <label id="profile-edit-pubkeywords-label" for="profile-edit-pubkeywords" >{{$lbl_pubkey}} </label> <input type="text" size="32" name="keywords" id="profile-edit-pubkeywords" title="{{$lbl_ex2}}" value="{{$keywords}}" /> </div><div id="profile-edit-pubkeywords-desc">{{$lbl_pubdsc}}</div> <div id="profile-edit-pubkeywords-end"></div> +{{/if}} -<div class="profile-edit-submit-wrapper" > -<input type="submit" name="submit" class="profile-edit-submit-button" value="{{$submit}}" /> -</div> -<div class="profile-edit-submit-end"></div> +{{if $fields.about}} <div id="about-jot-wrapper" > <p id="about-jot-desc" > {{$lbl_about}} @@ -174,9 +199,9 @@ </div> <div id="about-jot-end"></div> +{{/if}} - - +{{if $fields.contact}} <div id="contact-jot-wrapper" > <p id="contact-jot-desc" > {{$lbl_social}} @@ -186,9 +211,10 @@ </div> <div id="contact-jot-end"></div> +{{/if}} -{{if $advanced}} +{{if $fields.interest}} <div id="interest-jot-wrapper" > <p id="interest-jot-desc" > {{$lbl_hobbies}} @@ -198,8 +224,9 @@ </div> <div id="interest-jot-end"></div> +{{/if}} - +{{if $fields.likes}} <div id="likes-jot-wrapper" > <p id="likes-jot-desc" > {{$lbl_likes}} @@ -209,8 +236,9 @@ </div> <div id="likes-jot-end"></div> +{{/if}} - +{{if $fields.dislikes}} <div id="dislikes-jot-wrapper" > <p id="dislikes-jot-desc" > {{$lbl_dislikes}} @@ -220,8 +248,9 @@ </div> <div id="dislikes-jot-end"></div> +{{/if}} - +{{if $fields.channels}} <div id="channels-jot-wrapper" > <p id="channels-jot-desc" > {{$lbl_channels}} @@ -231,13 +260,9 @@ </div> <div id="channels-jot-end"></div> +{{/if}} -<div class="profile-edit-submit-wrapper" > -<input type="submit" name="submit" class="profile-edit-submit-button" value="{{$submit}}" /> -</div> -<div class="profile-edit-submit-end"></div> - - +{{if $fields.music}} <div id="music-jot-wrapper" > <p id="music-jot-desc" > {{$lbl_music}} @@ -247,7 +272,9 @@ </div> <div id="music-jot-end"></div> +{{/if}} +{{if $fields.book}} <div id="book-jot-wrapper" > <p id="book-jot-desc" > {{$lbl_book}} @@ -257,9 +284,9 @@ </div> <div id="book-jot-end"></div> +{{/if}} - - +{{if $fields.tv}} <div id="tv-jot-wrapper" > <p id="tv-jot-desc" > {{$lbl_tv}} @@ -269,9 +296,9 @@ </div> <div id="tv-jot-end"></div> +{{/if}} - - +{{if $fields.film}} <div id="film-jot-wrapper" > <p id="film-jot-desc" > {{$lbl_film}} @@ -281,14 +308,10 @@ </div> <div id="film-jot-end"></div> +{{/if}} -<div class="profile-edit-submit-wrapper" > -<input type="submit" name="submit" class="profile-edit-submit-button" value="{{$submit}}" /> -</div> -<div class="profile-edit-submit-end"></div> - - +{{if $fields.romance}} <div id="romance-jot-wrapper" > <p id="romance-jot-desc" > {{$lbl_love}} @@ -298,9 +321,9 @@ </div> <div id="romance-jot-end"></div> +{{/if}} - - +{{if $fields.work}} <div id="work-jot-wrapper" > <p id="work-jot-desc" > {{$lbl_work}} @@ -310,9 +333,9 @@ </div> <div id="work-jot-end"></div> +{{/if}} - - +{{if $fields.education}} <div id="education-jot-wrapper" > <p id="education-jot-desc" > {{$lbl_school}} @@ -322,9 +345,9 @@ </div> <div id="education-jot-end"></div> - {{/if}} + <div class="profile-edit-submit-wrapper" > <input type="submit" name="submit" class="profile-edit-submit-button" value="{{$submit}}" /> </div> |