From 01ddc21cc8f7e9613840e75a24448e9acfefaf0f Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Wed, 18 Sep 2024 13:53:38 -0400 Subject: [PATCH] feat: send confirmation message --- wp-content/plugins/bd4d/includes/class-bd4d.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/wp-content/plugins/bd4d/includes/class-bd4d.php b/wp-content/plugins/bd4d/includes/class-bd4d.php index 566ee37..542cc40 100644 --- a/wp-content/plugins/bd4d/includes/class-bd4d.php +++ b/wp-content/plugins/bd4d/includes/class-bd4d.php @@ -53,7 +53,7 @@ public static function enqueue_scripts() { '_ajax_url' => admin_url( 'admin-ajax.php' ), '_ajax_nonce' => wp_create_nonce( self::FIELD_NAME ), 'sitekey' => Google_Recaptcha::get_site_key(), - 'success' => 'Thank you for reaching out.', + 'success' => 'Thank you for reaching out to A Better Deal for Data.', 'error_codes' => [ self::SEND_ERROR => 'Unable to send message', self::JSON_ERROR => 'Unable to parse JSON result.', @@ -205,6 +205,7 @@ public static function send_message() { $result = self::add( $email, $first_name, $last_name, $message, $newsletter, $supporter ); if ( self::SEND_SUCCESS === $result ) { + self::send_confirmation_message( $email ); wp_send_json_success(); } @@ -216,6 +217,15 @@ public static function send_message() { wp_send_json_error( $data ); } + /** + * Send the user a message. + * + * @param string $recipient User's email address. + */ + public static function send_confirmation_message( $recipient ) { + wp_mail( $recipient, 'Thank you for reaching out to A Better Deal for Data', 'We appreciate your interest.' ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_mail_wp_mail + } + /** * Get the template part in an output buffer and return it *