Use this snippet in conjunction with Gravity Forms dynamic population functionality to populate the current user’s role into any form field.
This snippet assumes the “Allow field to be populated dynamically” option is checked and the Parameter Name option is set to “user_role”.
Need to apply conditional logic based on the user role? Just use this snippet to populate a hidden field with the user’s role. You can then apply conditional logic to other fields based on the value of that hidden field. Read this related tutorial for more information.