Skip to content

Instantly share code, notes, and snippets.

@spivurno
Created March 26, 2019 14:02
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 spivurno/65ad088bc50dac684167d981290295fe to your computer and use it in GitHub Desktop.
Save spivurno/65ad088bc50dac684167d981290295fe to your computer and use it in GitHub Desktop.
<?php
/**
* Gravity Perks // Populate Anything // Populate User Role
* http://gravitywiz.com/documentation/gravity-forms-populate-anything/
*/
add_filter( 'gppa_process_template', function( $value, $field, $template, $populate, $object, $object_type, $objects ) {
if( $template == 'role' && is_a( $object, 'WP_User' ) ) {
$value = implode( ', ', $object->roles );
}
return $value;
}, 10, 7 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment