Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer

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]);
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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