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

Don't make request on user login if API credentials are not set #125

Open
Nikschavan opened this issue Sep 23, 2024 · 0 comments
Open

Don't make request on user login if API credentials are not set #125

Nikschavan opened this issue Sep 23, 2024 · 0 comments

Comments

@Nikschavan
Copy link

In most of the places, the plugin checks if the API credentials are set or not and then makes requests to sailthru, for example -

// Get the content options to see if we want to fire the API.
$options = get_option( 'sailthru_content_settings' );
// Check to see if Content API is disabled in the UI
if( !isset ($options['sailthru_content_api_status'] ) || "false" === $options['sailthru_content_api_status'] ) {
return;
}
// See if a filter has disabled the content API, this may be done to override a specific use case.
if ( false === apply_filters( 'sailthru_content_api_enable', true ) ) {
return;
}

However, in the user login flow, the API credentials are not checked, and thus, the requests fail, and the error objects are logged to the error logs.

In non-production and local environments where these API credentials are not set, this keeps adding logs and making it difficult to debug actual errors.

if ( get_option( 'sailthru_setup_complete' ) ) {
$sailthru = get_option( 'sailthru_setup_options' );
$api_key = $sailthru['sailthru_api_key'];
$api_secret = $sailthru['sailthru_api_secret'];
$client = new WP_Sailthru_Client( $api_key, $api_secret );

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

No branches or pull requests

1 participant