ElkArte Community

Elk Development => Bug Reports => Topic started by: scripple on November 10, 2017, 07:43:01 am

Title: "Custom" Profile Fields are Weird
Post by: scripple on November 10, 2017, 07:43:01 am
So some of the default "custom" profile fields do odd things in 1.1 based on default values.

Personal text  gets saved as "Default Personal Text" or something like that and then shows up that way all over the forum if you don't set a value but update something else like setting an avatar.  The annoyingly when you change the default (to say nothing like it should be) it doesn't update all the people who got assigned the default value through updating some other part of the profile.

Gender shows up in the profile area (even when viewed by guests) even if the user doesn't set because it defaults to undisclosed.  Then if you modify it to have no default value it literally gets a default of "no default" which again causes it to show up everywhere with a value of "no default" which doesn't have an icon.  Manually deleting the "no default" from the databases fixed an empty/broken gender field from showing up in every profile.

Title: Re: "Custom" Profile Fields are Weird
Post by: Jorin on November 10, 2017, 09:17:39 am
You must have a gender!  :D
Title: Re: "Custom" Profile Fields are Weird
Post by: scripple on November 10, 2017, 06:38:07 pm
Apparently.  And it must be shown to the world at large as "undisclosed" or "no default".
Title: Re: "Custom" Profile Fields are Weird
Post by: live627 on November 10, 2017, 11:06:28 pm
The default should be an attack helicopter :D
Title: Re: "Custom" Profile Fields are Weird
Post by: emanuele on March 26, 2018, 11:18:22 pm
Tracked at https://github.com/elkarte/Elkarte/issues/3151
Title: Re: "Custom" Profile Fields are Weird
Post by: emanuele on April 01, 2018, 10:11:34 pm
@scripple would you mind give a try to this changes and see if they work?
In sources/subs/Profile.subs.php:
Code: (find) [Select]
			));

$context['custom_fields'][] = array(
Code: (replace with) [Select]
			));
$context['custom_fields_required'] = $context['custom_fields_required'] || $row['show_reg'];

if ($area !== 'register' && ($value === '' || $value === 'no_default'))
{
continue;
}
$context['custom_fields'][] = array(

and, if you want to be picky (but it should make any difference), remove the line:
Code: [Select]
$context['custom_fields_required'] = $context['custom_fields_required'] || $row['show_reg'];

The idea is to change the behaviour so that:
1) if it is the registration form and the field is set to be shown, show it,
2) if it is not the registration form and the field is set not to have a default value, then hide it.

there may be some edge case I missed, not unusual, that's where your help comes in. :)
Title: Re: "Custom" Profile Fields are Weird
Post by: scripple on April 02, 2018, 07:22:38 am
Sorry but this was so long ago I fixed it and don't even recall how.
Title: Re: "Custom" Profile Fields are Weird
Post by: emanuele on April 02, 2018, 05:29:44 pm
I didn't realize it was that much... :-[