Problem:
I am creating a website that allows users to upload resources for other users to download. In the (resource) content template, I would like to allow logged out users to be able to view the available resources but the files should only be downloadable by logged users.
Solution:
You can use Views shortcode [wpv-conditional] to check if current user is a logged in user, for example:
[wpv-conditional if="('[wpv-current-user info='id']' eq '')"] Non logged in users [/wpv-conditional] [wpv-conditional evaluate="false" if="('[wpv-current-user info='id']' eq '')"] Logged in users, display only the download file link. [/wpv-conditional]
Relevant Documentation:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
Conditional HTML Output in Views
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)
This topic contains 4 replies, has 2 voices.
Last updated by 6 years, 10 months ago.
Assisted by: Luo Yang.