filtering a Drupal View with ORed criteria

2020-04-12 09:30发布

问题:

I'm attempting to present a Drupal View that shows nodes in which the user's e-mail address shows up in one of two CCK text fields. Unfortunately, this doesn't seem to be possible using the stock version of Drupal's Views module - there doesn't appear to be a way to combine filtering criteria (except ANDing them), nor does their appear to be a way to do the custom logic for the filter's setting...

Is there a simple way of directly injecting additional information into a specific View's WHERE clause? If not, can it be done in another way?

回答1:

You can use the views_or module. It's still in dev but looks promising.

The other option is using hook_views_query_alter with $query->add_where() you should be able to add an or clause. You can also use it to add your aditional WHERE clause that you asked for.