Skip to content

Instantly share code, notes, and snippets.

@nathaningram
Created June 8, 2015 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathaningram/965628501dff4eb241e3 to your computer and use it in GitHub Desktop.
Save nathaningram/965628501dff4eb241e3 to your computer and use it in GitHub Desktop.
Prefill Gravity Form with User Data
// Prefill Gravity Form with User Data
function populate_usermeta($meta_key){ global $current_user;
return $current_user->__get($meta_key);
}
add_filter('gform_field_value_userfirstname', create_function("", '$value = populate_usermeta(\'user_firstname\'); return $value;' ));
add_filter('gform_field_value_userlastname', create_function("", '$value = populate_usermeta(\'user_lastname\'); return $value;' ));
add_filter('gform_field_value_useremail', create_function("", '$value = populate_usermeta(\'user_email\'); return $value;' ));
add_filter('gform_field_value_userwebsite', create_function("", '$value = populate_usermeta(\'user_url\'); return $value;' ));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment