Skip to content

Instantly share code, notes, and snippets.

@mikka23
Created June 18, 2021 12:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mikka23/990f8c7b0a1d1365eb4ed77e1f40e937 to your computer and use it in GitHub Desktop.
Save mikka23/990f8c7b0a1d1365eb4ed77e1f40e937 to your computer and use it in GitHub Desktop.
Send a reply
<?php
// Action to handle Fusion Form Data.
add_action( 'fusion_form_submission_data', 'fusion_handle_form_data', 10, 2 );
function fusion_handle_form_data( $data, $id ) {
/* IMPORTANT: Replace email_address with your field name. */
$email = $data['data']['email_address'];
/**
*
* You can get data of any field same way by replacing key value in array -> $data['data']['FIELD_NAME']
*
*/
// Send an email. Basic usage example.
wp_mail( $email, 'Avada Enquiry Confirmation', 'Thank you for your enquiry, we will get back to you shortly.' );
}
@BesirSebib
Copy link

Nice , thanks for sharing !

I was trying to use the same function but instead of wp_mail I used wp_redirect to pass the data as URL parameters as follows

$email = $data['data']['email_address'];
$WhatsApp_url = "https://api.whatsapp.com/send/?phone=#######&text=" + 'email:' + $email;
exit( wp_redirect( $WhatsApp_url));

But Im getting error ! could you please help ?
"There was an error trying to send your message. Please try again later."

@lesley1802
Copy link

Thanks for sharing this!

Novice here, but I wonder if possible to take it a step further and define two things:

A) Which form the auto reply is coming from ie have a different message for a few forms and B) show a custom FROM name ie not Wordpress

Any help truly appreciated

Lesley

@mikka23
Copy link
Author

mikka23 commented Apr 21, 2022

Hi Lesley. The code is no longer needed. In 7.7 the ability to set your own emails (and have multiple) was added. So you can add auto responder emails to each form via the builder now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment