• 1.
    <?php
  • 2.
    /**
  • 3.
    * Dynamically Populating User Role
  • 4.
    * http://gravitywiz.com/2012/04/30/dynamically-populating-user-role/
  • 5.
    */
  • 6.
    add_filter('gform_field_value_user_role', 'gform_populate_user_role');
  • 7.
    function gform_populate_user_role($value){
  • 8.
        $user = wp_get_current_user();
  • 9.
        return implode( ',', $user->roles );
  • 10.
    }
<?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(); return implode( ',', $user->roles ); }

Copy Code to Clipboard Raw

Sign-in or Create a Free Account.

Snippi uses Twitter or Facebook to register and create accounts. Registration will enable you to keep track of your snippets. We never spam your timeline or wall. Ever.

Sign-in with Facebook Sign-in with Twitter