Skip Navigation

[Resolved] Using Gutenberg Toolset Conditional block for User Fields/Forms

This thread is resolved. Here is a description of the problem and solution.

Problem:

Hello, I'm trying out the Toolset blocks in Gutenberg, but am having trouble translating what works in straight HTML vs what I need to place inside the Toolset Conditional block.

Solution:

Please try these:

( ( '[types usermeta="userfield1" output="raw" current_user="true"][/types]' = '1' ) AND ( '[wpv-search-term param="_success"]' != '' ) ) 
And test again.

Tip: Within shortcode [types ...][/types], you need to use double quotes instead of single quote

Relevant Documentation:

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

This topic contains 4 replies, has 2 voices.

Last updated by GamX 4 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#1749003

Hello, I'm trying out the Toolset blocks in Gutenberg, but am having trouble translating what works in straight HTML vs what I need to place inside the Toolset Conditional block. Please advise... thank you!

ULTIMATE GOAL: TRANSLATE THE FOLLOWING HTML CODE INTO A CONDITIONAL BLOCK (note: userfield1 is a radio field):
[wpv-conditional if="('[wpv-search-term param="_success"]' NE '') AND ('[types usermeta='userfield1' output='raw' current_user='true'][/types]' EQ '1')"]
[/wpv-conditional]

TOOLSET CONDITIONAL BLOCK STATEMENT THAT WORKS (after adding Toolset Conditional block, Add New Conditions, Advanced Editor):
( ( '[wpv-search-term param="_success"]' != '' ) )

TOOLSET CONDITIONAL BLOCK STATEMENT THAT DOES NOT WORK (TOOLSET ERROR: "Please, complete all the conditions or remove them"):
( ( '[wpv-search-term param="_success"]' != '') AND ( '[types usermeta='userfield1' output='raw' current_user='true'][/types]' = '1' ) )

#1753279

Hello,

Please try these:

  ( ( '[types usermeta="userfield1" output="raw" current_user="true"][/types]' = '1' ) AND ( '[wpv-search-term param="_success"]' != '' ) ) 

And test again.

Tip: Within shortcode [types ...][/types], you need to use double quotes instead of single quote.

#1754029

Thanks Luo, this works! Definitely needed that tip about the double quotes!
( ( '[types usermeta="userfield1" output="raw" current_user="true"][/types]' = '1' ) AND ( '[wpv-search-term param="_success"]' != '' ) )

Follow up question... I will have quite a few of these statements on the page with up to 3 variables in each statement. Would it be better to nest them, or to have a bunch of individual statements like the one above (which may include 3 variables) with different combinations of values? I want to make each page load as quickly as possible.

#1754197

I assume the original question has been resolved, according to our support policy, we prefer one ticket one question, for the questions, please check the new thread here:
https://toolset.com/forums/topic/i-will-have-quite-a-few-of-these-statements-on-the-page-with-up-to-3-variables-in-each-statement/

#1757017

My issue is resolved now. Thank you!