• Resolved exc1usive

    (@exc1usive)


    Hello!

    I cannot to figure out how to apply logical parenthesis to custom filters I add to List_Query.
    I have several fields on search form (Combo Multi Search plugin), if filter is set by the user the fields are added to the query using AND logic, right? Then, I want to add custom filter, only one field, but some times it have several search values which should be constructed using OR, but connected to previous filters from the form using AND. I do it in action ‘pdb-list_query_object’ in the loop, like this:

    if ( !empty($available_users) ) {
        foreach ($available_users as $u_login) {
    	$query_filter->add_filter('user_login', '=', $u_login, 'OR');
        }
    }

    And this way the search result is incorrect due the absence of parenthesis around the OR statements. Tell me if I misunderstood the whole concept.
    What would be the right way of doing it?

Viewing 2 replies - 16 through 17 (of 17 total)
Viewing 2 replies - 16 through 17 (of 17 total)

The topic ‘add_filter() logic parenthesis’ is closed to new replies.