humanmade / wp-stripe

WordPress Plug-in to manage donations made via the Stripe credit card payment solution
http://wordpress.org/extend/plugins/wp-stripe/
49 stars 22 forks source link

WP_STRIPE_KEY is undefined at plugin activation #25

Open bdgeorge opened 10 years ago

bdgeorge commented 10 years ago

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

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'] );
    }
}
willmot commented 10 years ago

Thanks for the bug report!

tchalvak commented 8 years ago

Yep, just got this on first install.