Skip Navigation

[Resolved] using wpv-current-user info='logged_in' in conditional block

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by brianD-14 1 year, 9 months ago.

Assisted by: Minesh.

Author
Posts
#2575933
Condition Block Details.png
conditions.png

I am trying to use a conditional block in a widget (Note: I'm using the Kadence theme) to check the user's login status. I'm seeing the same behavior described in an earlier support ticket:
https://toolset.com/forums/topic/using-wpv-current-user-infologged_in-in-conditional-block-revert-to-infoid/

In the thread of that ticket (Reply 2419653) Luo Yang confirms that was able to replicate the issue and that he would escalate it. After that, multiple workarounds are discussed in the remaining thread, before the ticket was closed as resolved. However, the only solution I can get to work is the custom function recommended by the user yonatanc in Reply #2428365.

I also tried another approach, which was to manually register [wpv-current-user] as a custom shortcode in Toolset Settings > Frontend Content, and then call that custom shortcode in the Conditional block, along with info="logged_in" as an attribute. Please see the attached screenshots.

In this way, I was able to save the condition without the wpv-current-user attribute reverting to info='id', but it's still not working on the front end as expected.

I can't find any way to make this work except with the custom function. That includes the suggested alternative condition (userID is empty).

Is there still an active work item (i.e., the escalation referenced by Luo Yang) in your product backlog and/or am missing something else?

Thanks,
Brian Doyle

#2576695

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

The alternate method to this is you should use or compare the current user ID and check if its empty or not.

Please check the following screenshot:
- hidden link

With Luo's ticket which is reported to our internal system the solution shared by our next level support is to use and compare the current user ID instead of logged_in value.

#2576887
Screenshot 2023-03-20 8.57.15 AM.png
Screenshot 2023-03-20 8.57.31 AM.png
Screenshot 2023-03-20 8.58.01 AM.png
Screenshot 2023-03-20 8.58.26 AM.png

Thank you. Unfortunately, I was not able to get that method to work. I believe the user who was corresponding with Luo last summer reported the same issue. See: https://toolset.com/forums/topic/using-wpv-current-user-infologged_in-in-conditional-block-revert-to-infoid/#post-2428821

I've attached several screen shots that show my attempt to configure the conditional using the UserID is (not) Empty argument, as well as the results on the front end, both when I'm logged in and when I'm logged out. None of the conditions seem to be triggering.

#2577371

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

That is really strange.

Can you please share problem URL where you configured your conditions as well as admin access details. Let me review whats going wrong with your setup.

I have set the next reply to private which means only you and I have access to it.

#2577615

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Toolset has limited integration with most of the Themes in your case you are using "Kadence" theme.

Also, Toolset is used to work with the the_content() area (post body). The widgets, header and footer is said to be managed by theme or possible theme integration with Toolset which is limited.

In your case I now recognize after reviewing your settings that you added the conditional statement with Widget area. So workaround is. I've created the following content template namely "Toolset Widget conditions" and added the conditional statement to this content template:
=> hidden link

As you can see I've added one condition that checks not empty with the above content template.

And then I've added that content template to your "Sidebar 2" (you can remove the conditions added to "Sidebar 2") and add whatever conditions you want to add to the content template "Toolset Widget conditions".

When I checked the page you shared: hidden link

I shows correct content I've added when current user ID is not empty (NOT EMPTY from CT).

#2578157

Minesh,

Thanks so much. That did the trick. So, as a general rule, should I always use a template when trying to use conditionals (or other advanced blocks) in the theme widgets?

Best regards,
Brian