Some hooks pass the Form meta object to the function, and you can add an if statement to run the code for a specific form (i.e. if($form["id"] == 1) .....)
In your case, you will want to use the gform_post_data filter. That filter also has an equivalent gform_post_data_FORMID that can be used to filter a specific form. The following code seems be what you need.
add_filter("gform_post_data_2", "set_post_info", 10, 2); //replace 2 with your form id
function custom_taxonomy($post_data, $form){
$post_data["post_title"] = $_POST["input_1"]; //replace input_1 with your hidden field name
$post_data["post_content"] = $_POST["input_2"] //replace input2 with your hidden field name
return $post_data;
}
Posted 15 years ago on Tuesday November 17, 2009 |
Permalink