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
Shane
Supporter
Les langues:
Anglais (English )
Fuseau horaire:
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
I tried this and no go.
[php]
[wpv-conditional if="([wpv-current-user info='role'] eq 'administrator')"]
//some html
[/wpv-conditional]
Shane
Supporter
Les langues:
Anglais (English )
Fuseau horaire:
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
####################
wpv-conditional attributes
####################
Array
(
[if] => (administrator = 'administrator')
[debug] => true
)
####################
Debug information
####################
--------------------
Original expression: (administrator = 'administrator')
--------------------
Shane
Supporter
Les langues:
Anglais (English )
Fuseau horaire:
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
The site is being developed locally on my machine.
Shane
Supporter
Les langues:
Anglais (English )
Fuseau horaire:
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