Special Considerations for Views Exposed Filters
I've taken to building customized administrative interfaces for clients using Views that are restricted by user role and plugged into the administration menu with a normal menu item. My latest creation was on an educational site that uses the Quiz module to test users who listen to online lectures. There's a special user role that has the ability to create quizzes for lectures, and we needed a simple way for them to locate any quiz or question node without having administer nodes access (as required by the default Content administration page). Thus the Quizzes and Questions View was born!
I didn't expect any hiccups, as I'd just be making a quickie table View that included quiz nodes and question nodes. Since access to the View is restricted by user role, I didn't even have to bother filtering out unpublished content. As I was adding the Node: Type filter, I decided on the fly to expose the filter so the administrators could easily drill down to a specific question type if necessary. I then added the necessary fields and went to my preview, where I discovered that forum nodes were included in the results. Yikes!
My first thought was that I'd messed up the settings on the filter, so I reviewed. I had selected the filter to only show Multi-choice question, Matching, True/false question, and Quiz nodes. The operator was locked, selection was limited to a single option, and I'd even checked the box to limit the options to the node types I'd selected. However, it appears that I had a faulty understanding of the Optional checkbox that needed correction.
I've made exposed filters before, and I knew that if I marked a filter as Optional it would default to an <Any> option. Because I limited my options to the node types I had selected, I expected it to still filter my results against all the possible node type options and limit it further based on my selection in the exposed filter. However, as long as the <Any> option was selected, the View simply would not filter for node type at all. The simple solution was to add a second node type filter that was not exposed and limited the nodes to the same types that I made available in the exposed filter. This doubling up gave me the behavior I was expecting.
This same method should hold true for any other exposed filter where you want the user to select from a subset of all the available options. As always, if there's an easier way, post it up in the comments.