Filter users by custom attributes – not showing all results

Permalink 1 user found helpful
When performing the following user attribute filters, I'm hoping to get all possible results, but I don't.
$this->userList->filterByAttribute('school_type', array('High School', 'Middle School'), 'LIKE');
OR
$this->userList->filterByAttribute('school_type', 'High School'));
$this->userList->filterByAttribute('school_type', 'Middle School'));

In my database:

User 1:
K-8

User 2:
High School
Middle School

User 3:
High School
Middle School
K-8
University

User 4:
University

User 5:
Middle School
University

User 6:
High School
University

These filters will only give me User 2, 3, and 6. I'm hoping to get User 5 as well. What am I doing wrong?

It doesn't matter if I change the filter comparison operator to '=' or 'LIKE', it gives me the same results.

Thanks!

 
hutman replied on at Permalink Reply
hutman
In 5.6 you could do something like this, I haven't tried it in 5.8 but it's worth a shot.

$this->userList->filter(false,"((ak_school_type LIKE '%High School%') OR (ak_school_type LIKE '%Middle School%'))");
cd13sr replied on at Permalink Reply
Well, apparently that still works! Thanks so much.