Skip to content

Instantly share code, notes, and snippets.

@spivurno
Last active May 7, 2022 21:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spivurno/3710924 to your computer and use it in GitHub Desktop.
Save spivurno/3710924 to your computer and use it in GitHub Desktop.
Gravity Wiz // Gravity Forms // Dynamically Populating User Role
<?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