Last active
May 7, 2022 21:54
-
-
Save spivurno/3710924 to your computer and use it in GitHub Desktop.
Gravity Wiz // Gravity Forms // Dynamically Populating User Role
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
<?php | |
/** | |
* Dynamically Populating User Role | |
* http://gravitywiz.com/2012/04/30/dynamically-populating-user-role/ | |
*/ | |
add_filter('gform_field_value_user_role', 'gform_populate_user_role'); | |
function gform_populate_user_role($value){ | |
$user = wp_get_current_user(); | |
$role = $user->roles; | |
return reset($role); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment