Created
January 26, 2015 00:04
-
-
Save codearachnid/a0850349f02ce9804301 to your computer and use it in GitHub Desktop.
Populate a gravity forms field for a currently logged in user
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
| <?php | |
| add_filter( 'gform_field_value_user_name', 'my_custom_gform_field_user_name' ); | |
| function my_custom_gform_field_user_name( $value ){ | |
| $current_user = wp_get_current_user(); | |
| if ( 0 != $current_user->ID ) { | |
| $value = $current_user->display_name; | |
| } | |
| return $value; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment