I am trying to set up a page that will show all our users that have consented to be on a membership list page. I have the View set up to show all users on the site that have the Member role. But now I need to make the display of each user conditional based on the contents of a specific user field. In the user form, we have a Yes/No radio button field to ask if they are OK with being shown in the list. If this field is Yes, then that user should be shown. If this field is No, then that user should not be shown.
I'm trying to set up a conditional in the loop to check on this field, but I'm not seeing our custom user fields showing in the options.
The display of this field in the view uses this code:
<td>[types usermeta="include-name"][/types]</td>
I'm assuming the conditional can be set up manually, but I'm not sure of the syntax to use.
Once I see how to set up the conditional based on if they give permission to list their name, we also have two other fields where they give permission to list their phone and e-mail. The display of those fields will need to be conditional as well, just to control the inclusion of their submitted data in those two fields. But the conditional based on their name will control whether they are included on the page at all, so that's the first one I want to get right.
Hello. Thank you for contacting the Toolset support.
As I understand - you do not want to display the users with certain usermeta values using the view.
If its the idea to remove the users from the list you are showing - so rather then using the conditional statement what if you add a "Query Filter" from your "Query Filter" section and add the query filter for your user custom field.
Actually, I closed this prematurely. Setting it up as a query filter worked for the first field check, but now I see I still need to set up conditional displays for the other two.
I have the query filter to only display users that said Yes to having their names on the list. But now we also have fields giving consent to use their e-mail address and phone number on the site. So I need to set up those fields to display only if a separate field has a Yes value. These are user fields. I'm not seeing how to define that in the conditional interface. I'm sure it can be done manually entering this, but I don't know the syntax to use.
If above doc does not help, please tell me what content you want to display conditionally based on what condition and share admin access details and problem URL where you want to add the condition.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
But it's working. You had it displaying the field that answers the question on the form where we ask if it is OK to display the phone and email. I changed it to display the actual phone and email fields. But the conditional syntax you provided is what I needed. I set up the view to display here:
hidden link
I changed the answers to the two questions to yes for one of the users and refreshed the page and the phone and email addresses did display on the page. I changed it back to no and the field data is hidden. So it's working.
Glad to know that solution I shared help you to resolve your issue.
Please kindly open a new ticket with every new question you may have. This will help other users searching on the forum as well as help us tor write correct problem resolution summery.
You can mark resolve this ticket by adding different message like "this ticket is resolved again"