Skip Navigation

[Resuelto] Cred form conditional output

This support ticket is created hace 6 años, 2 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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)

Este tema contiene 7 respuestas, tiene 2 mensajes.

Última actualización por Shane hace 6 años, 2 meses.

Asistido por: Shane.

Autor
Mensajes
#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

Idiomas: Inglés (English )

Zona horaria: 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

Idiomas: Inglés (English )

Zona horaria: 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

Idiomas: Inglés (English )

Zona horaria: 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

Idiomas: Inglés (English )

Zona horaria: 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