Closed mtekk closed 1 year ago
This appears to be caused by attempting to re-use the options update code base (specifically the maybe_update_from_form_imput()
function). This literally only affects booleans due to how checkboxes work (if not checked the value isn't sent).
A couple of potential fixes:
1) Export all booleans, or at a minimum all default set to true
booleans.
2) On import, merge in the defaults to the imports array (essentially merge in the opts array, which we're tying to get away from eventually) before going to the validation loop.
3) Add a parameter to maybe_update_from_form_input()
to bypass for missing defaults.
I don't particularly like any of these, option 3 is probably the most correct.
The current combined behavior of the settings exporter and the settings importer causes checkbox/boolean settings where the default value is "true"/checked to not export/import properly. This is due to the exporter just exporting the saved settings in the database, and the importer running these through the same function as saving/updating settings. Probably should get the importer to merge with the defaults before saving.