Implement additional filtering and searching options

Hello Gibbon Community,

I’m looking for a way to implement more filters and search options under Admin > User admin > Manage users and ideally also in People > Students > View Student Profile.

I have several Custom Fields for Students, Parents and Staff (mostly simple text input fields) that I would like to Search for in the same way that you are able to search for Username, Email, Phone Number, and so on. How do I make these Custom fields searchable?

I would also like to have additional filtering options here for year groups, form groups and custom fields. I have found how to add Filter Options to the dropdown menu above the table in /modules/’User Admin’, but have been unable to figure out how actually make these new options work as filters. The Custom fields in this case are yes/no fields or Dropdown fields with options.

I’m looking forward to any possible solutions!

Hi @JadenD welcome to the Gibbon community :smiley:

Sounds like you’re off to a good start if you’ve found the filter options. Filter options connect to a Gateway class, so in the case the UserGateway. If you look in there, there is a variable $searchableColumns that determines the columns that can be searched. If you were to add 'fields' to this array, it would enable searching your custom field data. It would indiscriminately search all of the data, but could help improve your searches.

In the UserGateway, you’ll also find an addFilterRules method call in the queryAllUsers method. This is where filters from addMetaData() are connected to the database query. This method can be called mulitple times, or with an array of multiple filter rules. Here’s an example for adding a yearGroup filter: Formal Assessment: add Year Group filter options to Manage External A… · GibbonEdu/core@7cb00c0 · GitHub

Gibbon is in a process of continuous refactoring, and it’s my hope to one day improve the data tables in a future version to have an interface similar to GitHub, which would enable a lot more custom filtering and searching. In the meantime, I hope the above info helps.

Be sure to check out the Core Development docs for some notes about modifying the core, so you don’t lose changes you make the next time you update Gibbon.