aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-03-04 15:29:10 -0800
committerzotlabs <mike@macgirvin.com>2018-03-04 15:29:10 -0800
commitbe6619d9c06a31fa211c6200aad377d94c1fd0b5 (patch)
treed4c1f04fe860e6de45f0451d2d63c07258db553b
parent14f701f7fc20104520a3837c6e6c359dfa0161f7 (diff)
downloadvolse-hubzilla-be6619d9c06a31fa211c6200aad377d94c1fd0b5.tar.gz
volse-hubzilla-be6619d9c06a31fa211c6200aad377d94c1fd0b5.tar.bz2
volse-hubzilla-be6619d9c06a31fa211c6200aad377d94c1fd0b5.zip
bugfix: unable to reset profile fields to defaults in admin/profs by emptying the textarea
-rw-r--r--Zotlabs/Module/Admin/Profs.php39
-rw-r--r--include/channel.php1
2 files changed, 31 insertions, 9 deletions
diff --git a/Zotlabs/Module/Admin/Profs.php b/Zotlabs/Module/Admin/Profs.php
index b3da09cb7..eb2501d43 100644
--- a/Zotlabs/Module/Admin/Profs.php
+++ b/Zotlabs/Module/Admin/Profs.php
@@ -9,17 +9,37 @@ class Profs {
if(array_key_exists('basic',$_REQUEST)) {
$arr = explode(',',$_REQUEST['basic']);
- for($x = 0; $x < count($arr); $x ++)
- if(trim($arr[$x]))
- $arr[$x] = trim($arr[$x]);
- set_config('system','profile_fields_basic',$arr);
-
+ array_walk($arr,'array_trim');
+ $narr = [];
+ if(count($arr)) {
+ foreach($arr as $a) {
+ if(strlen($a)) {
+ $narr[] = $a;
+ }
+ }
+ }
+ if(! $narr)
+ del_config('system','profile_fields_basic');
+ else
+ set_config('system','profile_fields_basic',$narr);
+
+
if(array_key_exists('advanced',$_REQUEST)) {
$arr = explode(',',$_REQUEST['advanced']);
- for($x = 0; $x < count($arr); $x ++)
- if(trim($arr[$x]))
- $arr[$x] = trim($arr[$x]);
- set_config('system','profile_fields_advanced',$arr);
+ array_walk($arr,'array_trim');
+ $narr = [];
+ if(count($arr)) {
+ foreach($arr as $a) {
+ if(strlen($a)) {
+ $narr[] = $a;
+ }
+ }
+ }
+ if(! $narr)
+ del_config('system','profile_fields_advanced');
+ else
+ set_config('system','profile_fields_advanced',$narr);
+
}
goaway(z_root() . '/admin/profs');
}
@@ -98,6 +118,7 @@ class Profs {
$basic = '';
$barr = array();
$fields = get_profile_fields_basic();
+
if(! $fields)
$fields = get_profile_fields_basic(1);
if($fields) {
diff --git a/include/channel.php b/include/channel.php
index a8ddfa978..204c1e64f 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -1897,6 +1897,7 @@ function is_public_profile() {
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('fullname','pdesc','chandesc','comms','gender','dob','dob_tz','region','country_name','marital','sexual','homepage','hometown','keywords','about','contact');