Skip Navigation

[Resolved] The Conditional Block Never Tests True, under any conditions except static value

This support ticket is created 2 years, 11 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 4 replies, has 2 voices.

Last updated by Waqar 2 years, 11 months ago.

Assisted by: Waqar.

Author
Posts
#2304249

I am trying to:
display things based upon role.
Link to a page where the issue can be seen: hidden link
If I have a conditional static value = static value and both sides are 1, then it displays. If I try to use role or post data then nothing display. If I put two conditional on one page, one of them being the static example and the other using user or post data, then nothing prints at all, not even the static values that are true.

I expected to see: the block, which says STATIC VALUE = 1

Instead, I got: nothing

#2304675

Hi,

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

To troubleshoot this, I'll need to see exactly how this page is set up in the admin area.

Can you please share temporary admin login details, in reply to this message? Make sure that the page includes at least one conditional block that is not working as expected.

Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.

regards,
Waqar

#2304925

While I was creating a page to demonstrate the problem, I realized that what I am really trying to do is determine if someone is logged in. Once they have logged in, they no longer need to see some particular buttons. So, I then tried to set up a conditional logic for determining if the visitor is logged in or not. And, I can not find any option in the conditional dropdown to express whether a user is logged in or not. So, that is what I need. I need to have a conditional block that determines whether or not a user is logged in.

#2304961

I further tried to use the shortcode

[wpv-current-user info="logged-in"] = STATIC VALUE true

And it did not work. I tried using values 0 and 1 for false and true and that didn't work. Even though the documentation says it returns true or false.

The output of [wpv-current-user info="logged-in"] displays the username. So, I tried comparing the shortcode to a STATIC VALUE of nothing... just no value listed in the conditional dialog. And, that didn't work. Quite frustrating.

#2305509
guest-conditional-check.png

Thank you for sharing these details.

To show some content, only to guests (i.e. non-logged-in) visitors, you can use an empty check for the current user's ID.
( example screenshot attached )

For guests, the value of the 'current user ID' will be empty and so the contents of the conditional block will show. For the logged-in users, the 'current user ID' will not be empty and so the same content won't be visible to them.