Skip to content

Instantly share code, notes, and snippets.

@codiller
Last active April 2, 2019 00:54
Show Gist options
  • Save codiller/a575af6e64046787e25b5b31b46c188c to your computer and use it in GitHub Desktop.
Save codiller/a575af6e64046787e25b5b31b46c188c to your computer and use it in GitHub Desktop.
<?php
/*
*
* Save email in a cookie for ActiveCampaign
*
*/
add_filter( 'gform_save_field_value', 'tlc_save_field_value', 10, 4);
function tlc_save_field_value( $value, $lead, $field, $form ) {
if ($field['label'] == 'Your Email') { // MAKE SURE THIS MATCHES THE NAME OF YOUR FIELD LABEL IN YOUR FORM
setcookie( 'email', htmlspecialchars($value, ENT_QUOTES), time() + 99999999, '/', NULL );
}
return $value;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment