How to filter by team and gender?

Events happening in the community are now at Drupal community events on www.drupal.org.
pkchoo's picture

I know I'm going to kick myself when I get the answer, but for some reason I can't get this to work.

I'm creating a view for a list of sports teams.

I'm able to create the listing fine, where all the teams members show up, but when I try to filter it also by gender, only the team title shows up.

I have a team content type with user references to populate the players. The view is grouped by the team title with a listing of the users and their attributes.

I suppose I could add a "gender" field to the user, but that would filter out the team coach if the coach was the opposite gender, right?

Any help would be greatly appreciated. Thank you.

Comments

Filter by gender

nidhi.tiwari's picture

Hi,
I am working for a dating site, I need to create a view to display opposite gender. In my registration profile page there is a field name as looking for on the basic of that field I want to show members.For example men can see only women & vice verse.

Please suggest me what should to in simple steps. Please reply me as soon as possible.

Use Contextual filter

naveenvalecha's picture

Hi Nidhi

Add a global field[php] in contextual filter and validate it by php code. Load the field "looking for on the basic " value by the global $user object and pass it to the argument.
use the above solution in my IMHO. :)

Thanks
Naveen Valecha

Use Contextual filter as suggested above

naveenvalecha's picture

Hi pkchoo,

I have a team content type with user references to populate the players. The view is grouped by the team title with a listing of the users and their attributes.

I suppose I could add a "gender" field to the user, but that would filter out the team coach if the coach was the opposite gender, right?

Use the same approach as you problem is also seems to be the same so use the same as I suggested here https://groups.drupal.org/node/187034#comment-1055458 IMHO :)

How to add php code in filter criteria

nidhi.tiwari's picture

I am not getting your point from where to add php code in filter criteria.
could you please explain it more.
I am in trouble.
Please reply me asap.
thanks for your reply :)
Regard's ,
Nidhi

Add global php code in contextual filter

naveenvalecha's picture

Add global php code in contextual filter

Newspapers on Drupal

Group organizers

Group categories

Topics - Newspaper on Drupal

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: