Alter a Views query to use "OR" through the user interface I have a view with a few different displays, each of them with slightly overridden filters, like this one used in a panel.

How do you add this pseudocode via the UI?

AND (node.type='story' OR node.comment_count &gt;=1)


I found an article (Better WHERE's for your Drupal forums with hook_views_query_alter), but I still don't know what to do.

What does the following code do, and what is "advf_filter"?

if ($view-&gt;name == 'YOURVIEW') {
  $view-&gt;query-&gt;add_where('advf_filter',"(node.type='%s' OR node_comment_statistics.comment_count &gt;= %d)",'forum',1);
  $view-&gt;query-&gt;set_group_operator('AND');
}
In Drupal 7 (Views 3), it's pretty simple, for regular filters at least:


For regular Filters, open the 'rearrange' (or "and/or, rearrange") window by clicking on the arrow next to 'Add'. From here it's simple and self-explanatory - you put your filters into Filter Groups, and can set each filter group to be 'OR' or 'AND'.
For Contextual Filters, it's a little bit stranger and is currently undergoing development work. Keep an eye on this issue: Document that contextual filters are included in the first 'and/or' filter group . As the title of that link suggests, all your contextual filters are treated as being part of whatever your first Filter Group is, so make sure there is at least one, and edit that as above. 


There's talk in that issue of changing this to something more flexible (watch above link), but that'll take time.

(note - talking about contextual filters is relevant to this question because someone closed a question about setting 'OR' on contextual filters as a duplicate and pointed it to this one)

-----UPDATE-----------

That issue closed with just a documentation change, here's a couple of relevant ongoing issues to follow...


Using OR in filters breaks contextual filters 
Views AND/OR Contextual filters two ways