Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Cameron Smith

Can I force a filter?

Working with the Users table, I want admins to see all of the users in the database, but all other users only get to see a subset, based on roles.

I know that I can create a custom set for non-admins and set a default filter for “Role = Club Member”, but the filter is still voluntary: the non-admin user can, when viewing the page, clear the default filter, thus showing all members, not just the “Club Members”.

Is there a way to either force the filter or, perhaps through a hook, pre-filter before the page is displayed?

1 year, 5 months ago
Stefan van den Dungen Gronovius
Developer

There is on way to force filters on an overview.
The Predefined files as you mentioned are the only way, but since filtering in our plugin is always a user action, it is also possible to clear these filters. If you want to force filters on the user page for specific roles, I recommend doing that in code by using a hook to filter on the WP_User_Query.

1 year, 5 months ago
Cameron Smith

Got it. Thanks.

1 year, 5 months ago

You must be logged in to reply to this topic.