Hi David,
Thanks for pointing me to the right hook. I've got this working. Here's the code I put in functions.php:
add_action("gform_pre_submission", "random_value_in_hidden_field");
function random_value_in_hidden_field($form){
$_POST["input_3"] = md5(rand(0,time()));
}
This I put in the notification email:
<a href="http:/mydomain.com/confirmation-page?usercode={Usercode:3}">Confirm your registration</a>
And this went in the confirmation page's php template:
<?php
if (empty($_GET)){}
else {
if (empty($_GET["usercode"])) {}
else {
$uc = $_GET["usercode"];
$sql = "SELECT * FROM <code>wp_rg_lead_detail</code> WHERE <code>value</code> = '$uc'";
$myrows = $wpdb->get_row( $sql, ARRAY_A );
if (empty($myrows)) {}
else {
$lead_id = $myrows["lead_id"];
$wpdb->update( 'wp_rg_lead_detail', array('value' => 1) , array( 'lead_id' => $lead_id, 'field_number' => 4) );
}
}
}
?>
Now a final cherry on the cake would be a second email to the client to confirm the confirmation of his registration was succesfully processed. Any chance there would be a way to do that with GF? Or should I just send an oldskool email from the same confirmation page by php?
Posted 11 years ago on Friday April 26, 2013 |
Permalink