Add search to Member model admin

Silverstripe Version:
4.21

Question:

I would like to filter the Member list in the admin area similar to how you can search for Pages. Pages adds a SearchContext that filters between dates (for CreateDate). Is there a simple way to achieve this. Can anyone point me in the right direction?

I have experimented with

private static $searchable_fields = array(...);

and

public function searchableFields() {...}

but I this only offers exact matches. I really need to Filter with GreaterThan and LessThan on a date field. Not sure how to go about this.

Hi @Jellygnite, check out the docs here, you can specify a different type of filter for your field in $searchable_fields. That will probably only let you do one or the other of a GreaterThan or LessThan field since the array is keyed by field name so you can’t include a field twice. To include two filters for one property you probably need to tinker with getDefaultSearchContext(), info here: Scaffolding with SearchContext – SilverStripe Documentation

Thanks JonoM. I have fiddled around with these already. I have tried adding these to a MemberExtension but haven’t had much luck so far. I will keep trying.