Using Drupal 8 Views, I’d like to make a user view where the Filter Criteria on left specify a certain display of users that will be shown only to a logged in user who has put a specific value in a profile field. Basically access to the view is granted to the logged in user only if they have a particular answer to a field in their profile.
A real world example of this type of view would be a dating website, where the logged in user who answered male in his profile field would see a view of the users who answered female on their profile fields. Another scenario is a person who is a doctor at a clinic who sees a user view of patients who input into a profile field that they were 80 years old, and this doctor is only granted access to this view if he input doctor in his profile field. But if he wrote nurse, he would not see this view. So basically, the right answer in a profile field, grants permission to see the user view.
I’ve tried taxonomy fields, and regular fields, to make a group of doctors who have selected the tag doctor and are allowed to see this view of 80 year old patients. Or to use the dating example, a group of men who have access to the view of women because they’ve selected the tag men. And then used contextual filters, relationships for those fields and the logged in user, but have not hit on the right specific solution.
The solutions I see are generally to provide a user view that is exactly the same group as the logged in user. I’m looking to provide a user view that is unrelated to the logged in user, and shown to him or her only if they answered a particular field with a particular value. I hope someone can provide some clear step by step insight. Thanks.