I created a Drupal 7 view that displays users profile 2 fields. However if i disable the user their fields are still visible in the view. Is there a way i can filter users by their status of blocked or active?
-
Add filter for status and set it as active/blocked which ever you need to display.– Ajay ReddyOct 26, 2017 at 12:54
-
searching for status in filter criteria comes up empty.– bluOct 26, 2017 at 12:56
-
1If it is a profile2 based View, then you have to create a relationship to the User. This should then create new filtering options based on that relationship.– KevinOct 26, 2017 at 13:02
-
i'm not entirely certain how thats done. all the way on the right under advanced and relationships i made one from indexed user to Main profile profile but i don't see any new filtering option.– bluOct 26, 2017 at 13:28
-
Indexed user? Is this Search API?– KevinOct 26, 2017 at 13:50
1 Answer
The steps are:
View name: test Show: Profiles of type: All
Page title: test Display format: table.
click "Continue & edit" button.
In the "FIELDS"
add the "Profile: User uid" field and add all fields related to the profile module.
Then add a relation in the path: Advanced-> RELATIONSHIPS
select the "Profile: User uid" field.
mark the checkbox "Require this relationship".
Click "apply (all displays)" button.
Then add a filter to "FILTER CRITERIA".
Seach and check the field: "User: Active"
We checked the checkbox: "Expose this filter to visitors, to allow them to change it"
Click "apply (all displays)" button.
Click "save" button.
-
this works if i create a new view but not the existing view. Profile: user uid doesnt appear– bluOct 26, 2017 at 15:32
-
In your view, follow these steps from: Then add a relation in the path: Advanced-> RELATIONSHIPS Oct 26, 2017 at 17:09
-
under the advanced-> RELATIONSHIPS there is no Profile: User uid or anything with uid in it's name– bluOct 26, 2017 at 18:12