[Resolved] conditional display, user meta = taxonomy
This support ticket is created 4 years, 5 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.
Tell us what you are trying to do?
Hello there I'm trying to create the follow scenario in our website, users should be able to see certain info depending on wheather or not they have signed an NDA. If they haven't signed an NDA for a certain sector, they will only see basic information when visiting the custom post type. If they have been given permission, then they can see all information.
I am trying to use conditional tags, or access tags. to achieve this, but I am running into an issue where I don't think there's documentation that quite covers what i'm doing so was wondering if toolset can do it. Elements of it are covered but I'm not sure if I can combine them.
Essentially I'm trying to conditionally display to function as follows. ------
USER Has toolset field called nda-sectors. (A set of check boxes, as they can have permissions for multiple sectors) -
Custom post type (prospectus) has multiple custom fields for normal visitors and multiple fields only for logged in NDA visitors, post type also has a custom taxonomy 'sectors' (a prospectus can be in multiple sectors)
I'm trying to create a conditional tag that does the following and I'm not sure if I can.
The possibility of multiple sector on both sides is making me fall down hard and I'm not sure if this is possible. Any help woulf be greatly appreciated.
What is the link to your site? hidden link
but it's a very basic hot mess right now for testing.
Hello and thank you for contacting the Toolset support.
The condition will not work because it does not get the proper input. The "Contains" function will verify if a value is included in an array(list). However, the [types usermeta='nda-sectors' current_user='true' output='raw'] will return a list instead of a single value.
You can create a custom function and register it to be used within conditional shortcodes, so you will get something like:
[wpv-conditional if = "(my_function_to_check([wpv-post-id]))"]
Thank you for you're direction, I've put this together but I have come across about 3 issue that I was hoping you might be able to help with/ have knowledge of. I'm using the following conditional statement and function but i'm quite new to wordpress and I think i'm missing something. it only seems to work on the term with the lowest ID, despite my user matching all 3 taxonomy items.