I use http://www.gravityforms.com/ to collect my data. Is it possible to use Gravity forms to capture leads just like you have with Contact Form 7?
Thanks again for your help. You are the best...I really do mean that..
Ed
I use http://www.gravityforms.com/ to collect my data. Is it possible to use Gravity forms to capture leads just like you have with Contact Form 7?
Thanks again for your help. You are the best...I really do mean that..
Ed
Essentially it is a contact form plugin so it should be doable but because gravity forms is a premium plugin we can't just start hacking that plugin.
We just need a hook that allows us to execute a bit of PHP code after the "Submit" button is clicked on the form. Maybe Gravity forms has an option to do this.
Can you please ask the gravity form guys if they have an option where we can add an action or hook so that when the "Submit" button is clicked on the form it will send us the submitted info to our action function? This will allow us to capture the lead after someone hits the "submit" button on the contact form.
Thanks. I will ask.
Hi I have just posted this on the GF forum as well; please give the following solution a try.
a) The GF form needs a minimum of three required fields:
e-mail address for the lead
hidden field to capture client IP
hidden field to capture unique id capable of being dynamically populated (I called mine unique_id)
b) Shortcut to invoke form and pass unique id (in case you want to call form from multiple places on your website)
[gravityform id=12 title=false description=false field_values='unique_id=1']
c) Following code to go into functions.php - replace form id with your GF form reference number and field numbers for the three $_POST's.
// November 2010 MJB - Add For Gravity Forms Post Submission
function gf_post_submission($entry, $form){
// Only Execute For Form 12 - Lead Capture
if($form['id'] != 12) return $form;
//Check For Presence Of Cookie ap_id
$aff_id = $_COOKIE['ap_id'];
if(!empty($aff_id))
{
// Build Lead Table Entries
$reference = $_POST["input_14"]; //Unique ID
$clientdate = (date ("Y-m-d"));
$clienttime = (date ("H:i:s"));
$buyer_email = $_POST["input_3"]; //Email
$ipaddress = $_POST["input_12"]; // Client IP Address
global $wpdb;
$affiliates_leads_table_name = $wpdb->prefix . "affiliates_leads_tbl";
$updatedb = "INSERT INTO $affiliates_leads_table_name (buyer_email,refid,reference,date,time,ipaddress) VALUES ('$buyer_email','$aff_id','$reference','$clientdate','$clienttime','$ipaddress')";
$results = $wpdb->query($updatedb);
}
}
add_action("gform_post_submission", "gf_post_submission", 10, 2);
// End Addition For Gravity Forms
Tested this morning and works for me...adding entries into the GF form and wp-affiliates Lead Gen table.
Michael.
Thank you for posting the solution Michael.
You must log in to post.