Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom settings are not saved due to newly introduced settings validation #782

Closed
nturbanov opened this issue Mar 26, 2020 · 1 comment
Closed
Milestone

Comments

@nturbanov
Copy link

Description

Custom settings fields (options) created using the auth0_settings_fields filter created as described in the documentation are not saved in the database upon saving changes in the Auth0 Settings.

I've tracked down the issue to the new validation done to settings where non-default option keys are unset.

// Remove unknown keys.
$option_keys = $this->a0_options->get_defaults( true );
foreach ( $input as $key => $val ) {
    if ( ! in_array( $key, $option_keys ) ) {
        unset( $input[ $key ] );
    }
}

There's currently no filter for the validation done here so the only way around this at the moment is to disable this validation.

Reproduction

Create a custom settings via the auth0_settings_fields filter as described here.

Go the Auth0 Settings in WP admin, input something in the custom field and Save Changes. Notice changes to the custom settings are not saved, instead the field is empty. Verify this by checking the value on the option wp_auth0_settings in the database.

To fix, comment out lines 99 to 104 in lib/admin/WP_Auth0_Admin.php.

Update setting again in WP admin and verify the custom setting is saved.

Environment

  • v 4.0.0-beta
@joshcanhelp
Copy link
Contributor

@nturbanov - Apologies for the trouble and I appreciate the detailed report here. We'll look into a fix right away.

@joshcanhelp joshcanhelp added this to the 4.0.0 milestone Mar 31, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants