Skip Navigation

[Resolved] Is there a better way than using wpv-if to hide sections in a form?

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to know how best to conditionally show or hide certain sections of a Form based on User role.

Solution: Access Control shortcodes should work well to hide content conditionally based on User role. Otherwise, conditional HTML can be used. The preferred shortcode now is wpv-conditional instead of wpv-if.

Relevant Documentation:
https://toolset.com/documentation/user-guides/access-control-texts-inside-page-content/
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

This support ticket is created 5 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1312599

I'm using wpv-if to hide a section in a form. That section is only to be viewed if the viewer's role is Administrator.

I just saw here that wpv-if is on legacy support. https://toolset.com/documentation/user-guides/legacy-support-for-wpv-if/

What is the proper way to hide sections in a form based on user role?

#1312609

What is the proper way to hide sections in a form based on user role?
Hi, I recommend Access Control shortcodes to show and hide form sections:
https://toolset.com/documentation/user-guides/access-control-texts-inside-page-content/

You will have to use the expert Form builder to be able to add these control shortcodes. Let me know if you have any questions about that.

#1312627

Thanks a bunch Christian,

I implemented this: [toolset_access role="Administrator, Editor"] [/toolset_access]

My issue is resolved now. Thank you!