Skip Navigation

[Resolved] Cred form conditional output

This support ticket is created 5 years, 8 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 7 replies, has 2 voices.

Last updated by Shane 5 years, 8 months ago.

Assisted by: Shane.

Author
Posts
#1102560

I am trying to: Only show html if user is admin

Link to a page where the issue can be seen: site is under local development

I expected to see:

I originally was using [wpv if] with the [wpv-current-user info='role'] to get this to work but it did not. I then saw using the conditional group and tried that and used the example for the user custom expression but could not get that to work either with a few different tweaks. My last current usage was

[cred_show_group if="(USER('role') eq 'administrator')"  mode='none']
//some html
[/cred_show_group]

Please advise how to get this to actually work. Thanks

#1102654

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Zachary,

Thank you for contacting our support forum.

The [cred_show_group] shortcode only works for CRED fields, what you should do is to use this shortcode below.

https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-conditional

Please try this and let me know if this helps.

Thanks,
Shane

#1102656

I tried this and no go.

[php]
[wpv-conditional if="([wpv-current-user info='role'] eq 'administrator')"]
//some html
[/wpv-conditional]

#1102668

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Zachary,

Could you try this and let me know what the output is on the frontend?

[wpv-conditional if="([wpv-current-user info='role'] eq 'administrator')" debug='true']
//some html
[/wpv-conditional]

Thanks,
Shane

#1102669

####################
wpv-conditional attributes
####################
Array
(
[if] => (administrator = 'administrator')
[debug] => true
)

####################
Debug information
####################
--------------------
Original expression: (administrator = 'administrator')
--------------------

#1102671

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Zachary,

Then it should display the correct results.

Would you mind providing me with access to the site so that I can take a look here?

Thanks,
Shane

#1104607

The site is being developed locally on my machine.

#1104665

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Zachary,

Would you be able to set this up on a testing site so that I can have a look ?

Thanks,
Shane

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.