Skip Navigation

[Resolved] Conditional statement for usermeta not working

This support ticket is created 5 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Beda 5 years, 6 months ago.

Assisted by: Beda.

Author
Posts
#1308257

I had this code working https://toolset.com/forums/topic/conditional-statement-for-usermeta/ and now all of the sudden it stopped working. I haven't touched it. Can you tell me how to fix? I recently updated toolset and think maybe that was it?

For instance I had this:

[wpv-conditional if="( '[wp_get_user_role username='[wpv-search-term param='church']']' eq 'pro_account' )"]  
This text
 [/wpv-conditional]

So this would make it so that it would show "this text" only if the account associated with the username found in the url (church=username) was in the "pro_account" user role. This is for logged out use, not logged in. Now nothing shows. Please help.

#1308549

You could check if it was the update by switching back to a previous version, as found in the "Changelog" section here https://toolset.com/account/downloads/

However, you have the apostrophes in the Conditional not alternating, which could be the cause.

I'd suggest to do this:
- output the ShortCodes outside the conditionals one by one:
[wp_get_user_role whatever_param_is_offered]
[wpv-search-term param='church']

Check if those values match what you expect.
Now, if yes, output the ShortCode with nested ShortCode as you do in the condition:
[wp_get_user_role username='[wpv-search-term param='church']']

If that produces the expected output, it should also work in the HTML condition, but only after the Custom ShortCode is registered in Toolset > Settings > Front-End Content.

Please let me know if after this the issue is not solved.