In general, I think you might have to combine two filters or hooks to make this happen. You will need to put this filter, to populate the name, inside a function that checks for the form ID, since the form ID is not used in gform_field_values.
You might do something like this (untested):
<?php
add_filter("gform_pre_render", "populate_name");
function populate_name($form){
// for form 5
if($form["id"] == 5) {
add_filter("gform_field_value_first_name", "read_name");
function read_name($value) {
// read your username here into the $username variable
return $username;
} // end read_name
// for form 1
if($form["id"] == 1) {
add_filter("gform_field_value_first_name", "read_name");
function read_name($value) {
// read your username here into the $username variable
return $username;
} // end read_name
} // end gform_field_value_first_name
return $form;
} // end gform_pre_render
That would be a high level overview of how to do it.
http://www.gravityhelp.com/documentation/page/Gform_field_value_$parameter_name
Posted 12 years ago on Wednesday January 11, 2012 |
Permalink