-
-
Save blueprintmrk/bf0bd46f68dbf0d14964 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adds a filter to form id 7. Replace 7 with your actual form id | |
add_filter('gform_pre_render_7', 'eo_form_pre_render'); | |
function eo_form_pre_render($form) | |
{ | |
// if no user is logged-in, do nothing | |
if ( !is_user_logged_in() ) | |
return $form; | |
foreach ($form['fields'] as &$field) | |
{ | |
// replace 2 with the actual ID of your Name field | |
if ( 2 == $field['id'] ) | |
{ | |
eo_populate_name_field($field, array( | |
'first' => eo_get_usermeta('first_name'), | |
'last' => eo_get_usermeta('last_name'), | |
)); | |
break; | |
} | |
} | |
return $form; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment