| @@ -18,11 +18,11 @@ | ||
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Option flag set once the user has submitted their email. |
| 22 | - * Works like a notice-dismiss flag: only '1' is stored, never the email. | |
| 22 | + * Works like a notice-dismiss flag: only `true` is stored, never the email. | |
| 23 | 23 | */ |
| 24 | -define( 'DISCO_AC_OPTION_KEY', 'disco_activecampaign_email_collected' ); | |
| 24 | +define( 'DISCO_AC_OPTION_KEY', 'disco_active_campaign_subscribe' ); | |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * AJAX action name. |
| 28 | 28 | */ |
| @@ -38,9 +38,9 @@ | ||
| 38 | 38 | * |
| 39 | 39 | * @return bool |
| 40 | 40 | */ |
| 41 | 41 | function disco_activecampaign_has_subscriber() { |
| 42 | - return '1' === get_option( DISCO_AC_OPTION_KEY ); | |
| 42 | + return (bool) get_option( DISCO_AC_OPTION_KEY, false ); | |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * Data localized for the React app. |
| @@ -73,9 +73,9 @@ | ||
| 73 | 73 | if ( ! current_user_can( 'manage_options' ) && ! current_user_can( 'manage_woocommerce' ) ) { |
| 74 | 74 | wp_send_json_error( array( 'message' => __( 'You are not allowed to do this.', 'disco' ) ), 403 ); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - update_option( DISCO_AC_OPTION_KEY, '1', false ); | |
| 77 | + update_option( DISCO_AC_OPTION_KEY, true, false ); | |
| 78 | 78 | |
| 79 | 79 | wp_send_json_success( |
| 80 | 80 | array( |
| 81 | 81 | 'message' => __( 'Thanks! You are subscribed.', 'disco' ), |