0

I'm using Drupal 6.

I have a custom view that needs to be filtered by an argument passed by the user.

The argument is a simple date, and I need my query to be filtered like the following:

WHERE created >= %argument&

Where %argument% is the user argument passed within the URL.

The thing is, I manage to filter it, but only as equals, like this:

WHERE created = %argument&

Is there any way I can make it filter as greater or equal to?

2

I've found that Drupal 6 views dont support such feature.

The solution was to implement the module_views_query_substitutions hook and alter the query manually:

function module_views_query_substitutions($view)
{
    $view->query->where[0]['clauses'][3] =
        str_replace('=', '>=', $view->query->where[0]['clauses'][3]);
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.