Skip Navigation

[Resolved] Conditionally display text to author of post only OR an admin

This support ticket is created 4 years, 7 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/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by Chris 4 years, 6 months ago.

Assisted by: Waqar.

Author
Posts
#1348885

I want to conditionally display some text to the author of the post being viewed but it also needs to be viewable by admins.

So far I have [wpv-conditional if="( '[wpv-user]' eq 'wpv-post-author' ) OR ( ??????? )"]..[/wpv-conditional]

But I am not sure what should go in the OR section - to get 'current user is an admin'.

Many thanks for your help

Chris

#1348975

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Chris,

Thank you for contacting us and I'd be happy to assist.

To get the current user's role, you can create a custom shortcode and then compare its value in a conditional block, as explained in this reply:
https://toolset.com/forums/topic/show-user-role-in-the-loop-of-users-with-views/#post-953233

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1353705

many thanks - all ok now!

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