Skip Navigation

[Resolved] Conditionally display form field group

This support ticket is created 3 years, 10 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 3 years, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#1988589

I am trying to limit display of form fields based on some field data OR whether the user viewing the form is an administrator.

So I have this that uses the custom field 'status'
[cred_show_group if="( $(status) eq '1238' ) OR ( $(status) eq '1032' ) OR ( $(status) eq '955' ) OR ( $(status) eq '70' )" mode="fade-slide"]

What would I need to add to this allow an administrator to see the group whatever the status field contains?

Many thanks

Chris

#1988669

Hello,

The shortcode [cred_show_group] is for custom fields/taxonomies, it does not work for user role, but you can try with [wpv-conditional] shortcode, for example:

[wpv-conditional if="( '[wpv-current-user info="role"]' eq 'administrator' ) "]
   
here display the field group...
   
[/wpv-conditional]

More help:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-current-user
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-conditional