Support Center

Integration with Gravity Forms WordPress Plugin

This guide shows how to integrate the Gravity Forms WordPress Plugin with your Fluttermail account. We assume that you have already installed and enabled the Gravity Forms Plugin in your WordPress application. More information on installation and settings of Gravity Forms is available here.

Gravity Forms does not provide an option to integrate with third party forms. So, we have to do it with coding.

1. Log in to your Fluttermail account. If you haven't already done so, go to the "Integration" tab and create a new form for your desired list with the required fields that you want to request.

2. Once you have created the form, hover over the respective form and click "Integrate with your site".

Fluttermail_SumoMe_Integration



3. Copy the HTML code under Embeddable HTML and paste it in an editor such as Notepad. Make a note of the fields' names. For this example, let us have two fields, Full Name and Email Address with the name "fullname" and "email", respectively. Also note down all the hidden fields' names and their respective values.

Fluttermail_SumoMe_Integration

4. Edit the /wp-content/themes/your-theme/functions.php file of your WordPress install. If you do not know how to do this, check with your hosting provider or your developer. Add the below piece of codes at the bottom of this file (but before the PHP closing tag):

add_action("gform_post_submission", "set_post_content", 10, 2);
 function set_post_content($entry, $form){
 //Gravity Forms has validated the data
 //Our Custom Form Submitted via PHP will go here
 // Lets get the IDs of the relevant fields and prepare an email message
 $message = print_r($entry, true);
 // In case any of our lines are larger than 70 characters, we should use wordwrap()
 $message = wordwrap($message, 70);
 // Send
 mail('youremail@yourdomain.com', 'Collecting the Gravity Form Field IDs', $message);
 }


Replace youremail@yourdomain.com with your Email address.

Visit your website's page or post where the Gravity Form is embedded. Assume your Gravity Form has two fields, Full Name and Email Address. Fill out the fields and submit the form. You will receive an email with content similar to below:

Array
(
    [id] => 8
    [form_id] => 1
    [date_created] => 2015-12-07 14:51:18
    [is_starred] => 0
    [is_read] => 0
    [ip] => 192.168.1.10
    [source_url] => http://yourdomain.com/gravityform
    [post_id] =>
    [currency] => USD
    [payment_status] =>
    [payment_date] =>
    [transaction_id] =>
    [payment_amount] =>
    [payment_method] =>
    [is_fulfilled] =>
    [created_by] => 1
    [transaction_type] =>
    [user_agent] => Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0)
Gecko/20100101 Firefox/42.0
    [status] => active
    [1] => Full Name
    [2] => youremail@yourdomain.com
)


Make a note of IDs for the fields Full Name and Email Address. In this example, the ID of Full Name is 1 and the ID of Email Address is 2.

5. Once again edit the /wp-content/themes/your-theme/functions.php file and remove the code that we added at Step 4. Add the below piece of code at the end of the file (but before the PHP closing tag). This script is self descriptive. Basically we are submitting the user's data into your Fluttermail Form, so that the user data will be added to your Fluttermail List:

add_action("gform_post_submission", "set_post_content", 10, 2);
function set_post_content($entry, $form){

function post_to_url($url, $data) {
$fields = '';
foreach($data as $key => $value) {
$fields .= $key . '=' . $value . '&';
}
rtrim($fields, '&');
$post = curl_init();
curl_setopt($post, CURLOPT_URL, $url);
curl_setopt($post, CURLOPT_POST, count($data));
curl_setopt($post, CURLOPT_POSTFIELDS, $fields);
curl_setopt($post, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($post);
curl_close($post);
}  

$data = array(
"fullname" => $entry["1"], //1 is the ID of Full Name.
"email" => $entry["2"], //2 is the ID of Email Address.
//Following fields and respective values were noted at Step 3.
"f" => '12345', //Fluttermail Form ID
"s" => '',
"c" => '0',
"m" => '0',
"act" => 'sub',
"nlbox[]" => '1234' //Fluttermail List ID
);
post_to_url("https://em.fluttermail.com/proc.php", $data);
}


The values of the IDs and fields in the above code will vary for your Form, so change them accordingly.

6. Visit your website's page or post where the Gravity Form is embedded. Fill out the fields and submit the form. Now, your user's data should be added to your Fluttermail List.
 

Contact Us

ticket@fluttermail.com
http://assets2.desk.com/
false
assistly
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete