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

#161 - Allow defining support monitor constants to override settings. #164

Merged
merged 4 commits into from
Mar 13, 2025

Conversation

joshuaabenazer
Copy link
Contributor

@joshuaabenazer joshuaabenazer commented Jul 18, 2024

Description of the Change

Allow defining support monitor constants to override settings. Support has been added for both network activation and single-site activation.
New constants that were introduced.

  1. SUPPORT_MONITOR_ENABLE
  2. SUPPORT_MONITOR_API_KEY
  3. SUPPORT_MONITOR_SERVER_URL

Closes #161

Default View:
image

View with Constants Set

define( 'SUPPORT_MONITOR_ENABLE', 'yes' );
define( 'SUPPORT_MONITOR_API_KEY', '123123123145' );
define( 'SUPPORT_MONITOR_SERVER_URL', 'https://example.org' );
image

How to test the Change

  1. Test out the settings for support monitor settings as part of this plugin on both a network activated multisite installation and a single site installation.
  2. Check by defining various combinations of all or some of the constants in the wp-config.php and reviewing the Support Monitor Settings. They should replace the user saved values and also not be editable when it is defined.
  3. Removing all or any of the constants from the wp-config.php should preserve the prior user saved values for the settings.

Changelog Entry

Added - New Support Monitor settings constants - SUPPORT_MONITOR_ENABLE, SUPPORT_MONITOR_API_KEY, SUPPORT_MONITOR_SERVER_URL

Credits

Props @joshuaabenazer, @darylldoyle, @claytoncollie

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@darylldoyle
Copy link
Contributor

@claytoncollie not sure if you want to test this one out?

@claytoncollie
Copy link
Contributor

@darylldoyle I pulled this branch into my project and it worked perfectly. Fields are being overwritten and set to disabled.

Thank you @joshuaabenazer for the effort here.

For reference, here are the definitions I used in my wp-config.php file.

define( 'SUPPORT_MONITOR_ENABLE', 'yes' );
define( 'SUPPORT_MONITOR_API_KEY', 'api key goes here' );
define( 'SUPPORT_MONITOR_SERVER_URL', 'https://google.com' );

@darylldoyle darylldoyle requested a review from tlovett1 July 25, 2024 08:43
Copy link
Contributor

@darylldoyle darylldoyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshuaabenazer nice work here!

Can we please update the UI when the values are set via constants? Currently when I set SUPPORT_MONITOR_ENABLE to yes in the cost, it still shows as No in the UI.

image

The same goes for the API Key and URL, the API key can be masked, but it'd be nice to show that there's a value set.

@darylldoyle darylldoyle dismissed their stale review March 12, 2025 13:02

I've made updates to this PR, so dismissing my own review from before

@darylldoyle darylldoyle merged commit d0f06ee into develop Mar 13, 2025
5 checks passed
@darylldoyle darylldoyle deleted the feature/161-support-monitor-constants branch March 13, 2025 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define Support Monitor options with constants inside wp-config
4 participants