Skip Navigation

[Gelöst] Conditional Content if User Not Logged in

This support ticket is created vor 2 Jahren, 11 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

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)

Dieses Thema enthält 1 Antwort, hat 2 Stimmen.

Zuletzt aktualisiert von Waqar vor 2 Jahren, 11 Monaten.

Assistiert von: Waqar.

Author
Artikel
#2233355

Hi There - Apologies I let this one slip because of the Thanksgiving holiday and now the original ticket has been closed. Can you please reopen and continue assisting? Link below:

https://toolset.com/forums/topic/conditional-content-if-user-not-logged-in/

Thanks.

- Aaron

#2233723
user-login-check.png

Hi Aaron,

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

Shane is on vacation so we can continue on this new ticket.

It is important to note that, Toolset's blocks (including the conditional block) are not officially supported inside the new blocks-based WordPress widget area. Also, the conditional block doesn't work from inside reusable or grouped blocks.

Based on some tests on my website, here is a workaround that you can use:

1. You can create a new content template from WP Admin -> Toolset -> Content Templates. In this template, you can add the blocks and any content that you'd like to show in the sidebar or widget area. The conditional block will work from inside the content template too.

2. Once the content template is ready, you can load it from a "Custom HTML" block in your desired widget area, using the shortcode:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body


[wpv-post-body view_template="CT Name"]

Note: You'll replace "CT Name" with the actual name of your content template.

And for checking the user's logged-in status in the conditional statements, you can use the option "Current user ID", as shown in the attached screenshot.
( for a logged-in user, it will not be empty and for a non-logged-in visitor, it will be empty )

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

regards,
Waqar