I am running on elgg 2.3.0. Is there a reason why the first field can't be deleted? This fields starts with id 0. This doesn't happen to the fields created after the first field though. The only way to delete the field is if you click reset but the rest of the fields will be deleted as well.
https://github.com/Elgg/Elgg/blob/2.3/actions/profile/fields/delete.php#L18
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Alejandro@dveloper
Alejandro - 0 likes
- ihayredinov@ihayredinov
ihayredinov - 0 likes
You must log in to post replies.I finally figured out. I kept on going on circles why the following statement was never true when deleting the first field, which is id=0.
if ($id &&
unset_config("admin_defined_profile_$id") &&
unset_config("admin_defined_profile_type_$id") &&
elgg_save_config('profile_custom_fields', $fieldlist)) {
system_message(elgg_echo('profile:editdefault:delete:success'));
} else {
register_error(elgg_echo('profile:editdefault:delete:fail'));
}
Evaluating id for value zero is not evaluating as true but false or empty, in order to fix this it should be isset($id)
Now this brings up the question of whether this is a bug or was written like this on purpose not to allow users to delete the first field created.
Sounds like a bug, please report on github