-
Notifications
You must be signed in to change notification settings - Fork 92
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
Basic settings edit box doesn't show values from AUTH0_ENV_* constants #569
Comments
@Floppy - Thank you for the very complete report here! I'm not sure what to say here, it definitely should be showing the value that's set in the constant. We have a whole pile of unit tests to confirm that it does as well. I'm wondering if it's some kind of cache issue on your server. If you try to get that value, what comes back? $constant_val = AUTH0_ENV_DOMAIN;
$settings_val = WP_Auth0_Options::Instance()->get('domain');
echo $constant_val === $settings_val ? 'Yay' : 'Uh oh'; Also, what value is getting used on the site? I'm guessing it's the database one but good to test that as well. It replaces the database value in the settings array used when the plugin loads so even if there's something in the database, that should be ignored. You can try saving the options and see what the options array is after that (it should delete the value when you save with a constant defined). Other than that, I'm not sure where to go with this. Let me know if you need any guidance debugging where this is going wrong. Pretty much everything happens in |
Thanks @joshcanhelp, I'm glad I checked! I'll dig into the code; I've not verified which value is actually being used yet, I was on a bit of a deadline at the time. However, I've now backed out the change and decoupled the problem so I can investigate at my leisure. |
Just got chance to take another look, and tried some more things. I altered
The result is: As you can see, the values are different! The value in the notice is the correct one from the environment, set in the constant, while the value in the box is the value from the database. I'll keep poking, and try to verify exactly which is being used. |
So, I dropped the code from @joshcanhelp's comment above into |
Hitting "Save" on the basic admin page gave me a blank screen, then when I went back to the page, there was nothing in the domain or client ID fields (and a warning saying they can't be empty), which doesn't sound like it saved the constant data into the DB as expected. |
@Floppy - If the constants are getting picked up and their values are available, then the issue must be in https://github.com/auth0/wp-auth0/blob/master/lib/WP_Auth0_Options_Generic.php#L138 Are you using the That method uses https://github.com/auth0/wp-auth0/blob/master/lib/WP_Auth0_Options_Generic.php#L106 The |
Chiming in on this one. @joshcanhelp I had this same issue where setting constants in my More of a problem is that when the shortcode was added to the page, I was getting the JavaScript that Auth0 isn't configured - even though everything was. Is there some flag that indicates the setup is done? If so, it seems this isn't being properly triggered when the constants method is used. |
It's all runtime, no process needs to happen to save those anywhere. But you mentioned Can you both try moving those definitions to |
Ahh good point. The way our local (Docker) and production (VPS) is setup is such that we only manage the theme in our repo and never touch the It turns your that you're absolutely right. This implementation works in the |
@Floppy ☝️ @toddheslin - Thanks for trying that out! I'll make sure the plugin is not picking up those constants if it's not also using them. I don't think it's going to be possible to use constants in Our docs are open source, here is an edit link for that page: https://github.com/auth0/docs/edit/master/articles/cms/wordpress/configuration.md I'll leave this issue open to track until I get this merged into master. Thanks for your help with this! |
Ah, interesting, I'm setting it in |
Status update on this one - adding it to a |
Great, thank you @toddheslin! I'll make sure the next version does not show the message unless it's actually using the constant as well as updating the documentation to be more clear. |
Description
When using the configuration constants like
AUTH0_ENV_CLIENT_ID
, the basic settings form shows that the constant is in use via the message above the edit box, but the contents of the edit box show (I am fairly sure) the value loaded from the the database configuration, not the constant.I've verified the value of the constants using https://wordpress.org/plugins/view-defined-constants-littlebizzy/, and they are definitely correct, but the value text on the settings page is outdated.
Does this seem possible?
Prerequisites
Environment
Please provide the following:
Reproduction
AUTH0_ENV_DOMAIN
etc that use different valuesScreenshots
Auth0 basic settings page:
View Constants plugin view of the relevant value:
The text was updated successfully, but these errors were encountered: