[Escalated to 2nd Tier] Conditional display: if user checkbox not ticked
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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
It's not so easy to add conditions using types user fields like this.
I first inserted a types user field directly into the editor to generate the shortcode in the right format, and then added that to a conditional shortcode.
This is what I ended up with, and if I have understood what you are aiming for I think it is what you need:
[wpv-conditional if="( '[types usermeta='visible' user_is_author='true'][/types]' ne '1' )"]
Surprise!
[/wpv-conditional]
OK, let me get credentials and I can check the set up.
I will mark your next reply as private, you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup.
When you say single posts, you are referring to the built-in Post post type?
The author Barbara has the Not advertising field checked and so it is equal to 1.
If I output your author_archive shortcode it correctly outputs her ID.
If I output the types field, passing the user_id manually, then it correctly outputs 1.
If I output the types field passing the user_id via your shortcode it also correctly outputs 1.
So far so good.
Now to the conditional shortcode.
Trying the condition while passing the user_id manually seems to work. The condition is if the types field is not equal to 1. Well it's not, and nothing is output, so that's okay.
Now to the crunch test, the same, but with the user_id passed by your shortcode.
Also works!
Nothing is output.
So, let me verify by editing Barbara's profile, and unchecking the checkbox, so that the value will no longer be 1.
Ah. That doesn't work correctly.
Fiddling around a little I notice the debug info isn't working properly, as if the custom shortcode is breaking the conditional shortcode to such an extent that even that doesn't work.
I'm conscious that this is a live site and I don't want to break anything, so I'm going to take a copy of the site so that I can test it more thoroughly locally.
I've set up something very similar on my local site and it works correctly, so it is something specific to your site I need to pin down.
Yes, it's large, but I managed to take a copy, which I've installed locally and where I get the same results.
Something breaks the conditional shortcode such that it doesn't even show the debug info.
I need to pass this up to the second tier so that some deeper debugging can be performed, so I'm marking this as escalated and will get back to you when I have some more news.
So we were able to reproduce this in the end on a clean site, and are seeking clarity from the Views developer as to whether it is expected to work, and requesting a fix if so.
When I have a reply from them, I'll let you know the details.