# Show/hide fields or sections based on user role

**URL:** <https://community.gravityforms.com/t/show-hide-fields-or-sections-based-on-user-role/178>\
**Category:** Feature Requests\
**Tags:** gform\_field\_value, user-meta, gravity-wiz\
**Created:** [October 24, 2018, 3:08pm UTC](https://community.gravityforms.com/t/show-hide-fields-or-sections-based-on-user-role/178 "2018-10-24T15:08:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryan99](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@ryan99](https://community.gravityforms.com/u/ryan99)\
**Post date:** [October 24, 2018, 3:08pm UTC](https://community.gravityforms.com/t/show-hide-fields-or-sections-based-on-user-role/178/1 "2018-10-24T15:08:11Z")

</div>

To add to the conditional logic functionality it would be amazing if there was an ability to show/hide fields based on user role. ie: admin, editor, etc.

Usage case – Someone is registering for an event. They log in to RSVP and depending on the user type they are shown various fields that only their role should see.

How to get around this as of now – when a user logs in have a custom redirection based on the user type to 1 of several forms -or- they have to select which type of registrant they are manually to then trigger the conditional logic.

Thank you for considering this!

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [October 24, 2018, 4:14pm UTC](https://community.gravityforms.com/t/show-hide-fields-or-sections-based-on-user-role/178/2 "2018-10-24T16:14:40Z")

</div>

Will this approach work for you?

[https://gravitywiz.com/gravity-forms-conditional-logic-based-on-user-login/](https://gravitywiz.com/gravity-forms-conditional-logic-based-on-user-login/)

---

<div class="post-metadata">

**Author:** ![ryan99](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@ryan99](https://community.gravityforms.com/u/ryan99)\
**Post date:** [October 24, 2018, 5:05pm UTC](https://community.gravityforms.com/t/show-hide-fields-or-sections-based-on-user-role/178/3 "2018-10-24T17:05:07Z")

</div>

Looks like using any value which GF now supports might work… however it would be nice have it built-in to display a drop down… Show/hide field if user role = x

Thanks for the tip.

---

<div class="post-metadata">

**Author:** ![ryan99](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@ryan99](https://community.gravityforms.com/u/ryan99)\
**Post date:** [October 24, 2018, 8:16pm UTC](https://community.gravityforms.com/t/show-hide-fields-or-sections-based-on-user-role/178/4 "2018-10-24T20:16:54Z")

</div>

So… what would you put in the “default value” field in the hidden field to trigger another field to be visible for say, all admin roles?

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [October 24, 2018, 9:48pm UTC](https://community.gravityforms.com/t/show-hide-fields-or-sections-based-on-user-role/178/5 "2018-10-24T21:48:08Z")

</div>

That Gravity Wiz solution only works specifically for logged in or not. If you have a small number of admin users, you could have the conditional logic rules to be

ANY  
If logged in username is chris  
if logged in username is support  
if logged in username is kevin  
if logged in username is gravity

THEN show the field. If you have a lot of admin users or the users change frequently you’ll need another approach. Let us know what you need specifically. It’s not a built in feature, but it should be possible to create something.

---

<div class="post-metadata">

**Author:** ![user5b917aeba75829.5](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@user5b917aeba75829.5](https://community.gravityforms.com/u/user5b917aeba75829.5)\
**Post date:** [October 28, 2019, 7:49pm UTC](https://community.gravityforms.com/t/show-hide-fields-or-sections-based-on-user-role/178/6 "2019-10-28T19:49:10Z")

</div>

@ryan99 OR you probably could use advanced conditional logic by McDonnell NZ.  
Link is here : [[https://mcdonnell.nz/product/gravity-forms-user-role-conditional-logic/](https://mcdonnell.nz/product/gravity-forms-user-role-conditional-logic/)]

---

<div class="post-metadata">

**Author:** ![user5d02f92a48552959](https://avatars.discourse-cdn.com/v4/letter/u/838e76/32.png) [@user5d02f92a48552959](https://community.gravityforms.com/u/user5d02f92a48552959)\
**Post date:** [October 29, 2019, 11:41pm UTC](https://community.gravityforms.com/t/show-hide-fields-or-sections-based-on-user-role/178/7 "2019-10-29T23:41:13Z")

</div>

The above link is the type of thing that OP was asking for @chrishajer. To be honest it’s something I’ll almost certainly require in the future, too.

One of the big hinderences to large organisations using gravity forms is that you’re not a well known vendor in the enterprise environment. I can get around this often enough by pointing to the regular updates, support team, etc. But when it comes to adding a $15 plugin from a single developer to add functionality like “If in Role, then display something”, then I have little chance of getting that through. Much better if the GF team could build that functionality in.

---

<div class="post-metadata">

**Author:** ![matthijsd](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@matthijsd](https://community.gravityforms.com/u/matthijsd)\
**Post date:** [October 30, 2019, 1:07pm UTC](https://community.gravityforms.com/t/show-hide-fields-or-sections-based-on-user-role/178/8 "2019-10-30T13:07:19Z")

</div>

Is putting the role in a hidden field here a secure route? As users can edit values from the hidden field?

---

<div class="post-metadata">

**Author:** ![richardw8k](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/richardw8k/32/2354_2.png) [@richardw8k](https://community.gravityforms.com/u/richardw8k)\
**Post date:** [July 29, 2021, 1:58pm UTC](https://community.gravityforms.com/t/show-hide-fields-or-sections-based-on-user-role/178/9 "2021-07-29T13:58:24Z")

</div>


