james6848
james6848

Reputation: 1667

Drupal 6 Views - Don't display a row if one field is empty

Is it possible not to display a Views row if one of its constituent fields is empty?

In my case I have a list of users with their username and picture, and I only want to display those users who have uploaded an image.

Cheers!

Upvotes: 0

Views: 2255

Answers (2)

tachikoma num5
tachikoma num5

Reputation: 31

I only have a few mins, so I didn't have a chance to test this. For the general question is it possible not to display a Views row if one of its constituent fields is empty.

Row style: Fields Row style options - Hide empty fields

Add all the (non-picture) fields for the row, and "Exclude from display" Then have the picture field be the last field so it can use the replacement patterns for all the other fields.

For the Picture options, "Hide if empty". "Rewrite the output of this field" and add the html and "Replacement patterns" for the all the fields in the Text box.

Upvotes: 3

Laxman13
Laxman13

Reputation: 5211

Yes, you need to add a filter to your view.

Add the filter User: Picture and for Has Avatar check "Yes", click update and save your view to see the changes. Users who don't have a profile picture will not show up in the view.

Upvotes: 2

Related Questions