Skip to content

Commit

Permalink
Merge pull request #3 from techmatters/feat/email-confirmation
Browse files Browse the repository at this point in the history
feat: send confirmation message
  • Loading branch information
paulschreiber authored Sep 18, 2024
2 parents 900dc2b + 01ddc21 commit e1cc51b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion wp-content/plugins/bd4d/includes/class-bd4d.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down Expand Up @@ -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();
}

Expand All @@ -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
*
Expand Down

0 comments on commit e1cc51b

Please sign in to comment.