I have 2 flag types for a content type. both flags have flag field. consider the user flagged a content by both flags. I want to show user data. I have problems in this situation. I add flag A and flag B in relationship part of views, after that I add "username of user" and "flag field" in fields part. but unfortunately I should add 2 "username" field, one of them should relation to flag A and other should relation to flag B(relation part in field setting). this is problem. because I want one field of "username", not 2 "username" fields. What should I do?
Add a filter for the whole view that checks username in both fields as not null, and set the operator to 'And'.
In your view under 'Filter Criteria' do the following:
- Add user name with the first relationship and set the operator to 'is not empty (NULL).
- Do the same for the second username field.
- Click the dropdown arrow next to add for 'Filter Criteria'. Select And/OR, Rearrange and add an 'AND' operator between the two filter.
- Hide the second username from display.
That way you can filter for users with both flags.
It seems that the crucial part of your (updated) question (as in revision 3 of it) is that you need use filters that are related to "either of your 5 flags", which means that Views should use an "OR" (instead of "AND", which is the default) in its query.
To make that possible, you can use the Views Contextual Filters OR module (which only has a dev version today, though close to 2K sites are using it).
Excerpt from its project page:
... provides a views plugin which modify query to support OR conditions for contextual filters.
... A new option will appear in settings page query. If the option is enabled the query will be rewritten using operator OR.
Have a look at the image below (also from the project page), near the bottom of it there is a checkbox titled "Contextual filters OR":
So after you enable this module and check this checkbox, you may get it to work. To actually do so, you need to enhance/correct the view you already seem to have, similar to what is detailed already in the answer from balmong. But for the filter criteria make sure to use "OR" (instead of "AND"), and make sure you do so for all your 5 flags (as in your updated question, so not just for the 2 you originally mentioned).