Created
June 8, 2015 15:36
-
-
Save nathaningram/965628501dff4eb241e3 to your computer and use it in GitHub Desktop.
Prefill Gravity Form with User Data
This file contains 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
// 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