humanmade / humanmade/wp-stripe

WP_STRIPE_KEY is undefined at plugin activation

Open
#25 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
PHP
Stars
47
Forks
18
PR merge metrics
No merged PRs in 30d

Description

It's only a warning until the API options are configured, but when first activated we get the following annoying notice message:

![screen shot 2014-08-18 at 3 31 14 pm](https://cloud.githubusercontent.com/assets/562621/3947922/f56e7054-2698-11e4-9533-a74675bcf67a.png)

This is because the constant is only defined after the api options have been set

```
if ( ! empty( $options['stripe_api_switch'] ) ) {

if ( $options['stripe_api_switch'] === 'Yes') {
Stripe::setApiKey( $options['stripe_test_api'] );
define( 'WP_STRIPE_KEY', $options['stripe_test_api_publish'] );

} else {
Stripe::setApiKey( $options['stripe_prod_api'] );
define( 'WP_STRIPE_KEY', $options['stripe_prod_api_publish'] );
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the plugin activation path containing the shown API-options conditional and the WP_STRIPE_KEY definition. Reproduce activation before API options are configured, then verify the notice no longer appears while configured test and production settings still define the key correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
payments
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.