0

I have standard 4.0.1 wordpress site through which I'm selling digital content with woocommerce. I have permission scheme set up so that i have thousands of user groups (group can access certain content of site, via woocommerce groups). It all plays out fine but i can't find any information how to hide group filtering links in user administration area. I mean those:

All (15,826) | Administrator (1) | Subscriber (14,664) | ...

It's all good when there's just few of them but in case of thousands of groups it becomes huge mess which one finds hard to show it to the client with clear consciousness.

I could basically hack into wordpress core and get this part ripped out but then i can't update it if new version comes out.

Is there any standard way to hide parts of the page in standard admin module? I know one can hide some parts of the page with "Screen settings" but under users tab you can show/hide the table columns but not get rid of the filtering section. Perhaps all there has to be done is to add the section to filters somehow.

I sort of anticipated this problem but secretly hoped that if there's many entries the list will turn into type-ahead control (like it happens in some other plugins) or at least into dropdown... but it didn't.

Any ideas? Thanks.

  • 1
    wordpress UI is not designed to handle 1k items of any kind, and if you are serious about managing them easily then you should probably build your own version of the admin UI or modify the current one. Please edit the question and try to be more specific about the solution you actually would like to implement. – Mark Kaplun Dec 8 '14 at 20:46
  • Please explain why you want to do it that way. It could be that you are facing a XY Problem. Having 1k "groups" will seriously slow down your site. A "group" (WP calls that "user role") normally is meant to bundle capabilities. Those exist in a single entry in your database on the one hand. On the other hand you can't that many different capabilities. Please provide an update to your question with an edit and explain the problem that forces you to do that. – kaiser Dec 8 '14 at 23:02
  • @kaiser: capability to read article 1, other for article 2. This way woocommerce groups plugin can "sell" the group access. – dsomnus Dec 9 '14 at 2:53
  • @dsomnus There is one capability per article? Honestly? Could you link to the plugin? – kaiser Dec 9 '14 at 3:22
  • 1
    Because capabilities live in a single, serialized array - an example can be found in this question - and that is per user and because of the serialization not searchable. Categories have their own table (and meta table) and add one row per capability. And that means that search will be done on DB level. Now imagine checking a user cap and searching through a 1k array per user just find the 1 admin in 15k users. – kaiser Dec 9 '14 at 16:08
1

In WP terminology these are called Views. They are pretty generic, implemented on WP_List_Table level and passed through dynamic views_{$this->screen->id} filter.

Killing them completely for your requirements is as simple as:

add_filter( 'views_users', '__return_empty_array' );

Of course you might want to do something more thorough, like modifying them more precisely and leaving some necessary views in.

  • Thanks, that does work. Apparently the groups plugin was adding those groups there, just uncommented their filter and it's as good as it gets, i can live with that change in case plugin gets updated. Just out of curiousity I'm wondering if there's a way to disable plugin executing it.. Perhaps overwrite the filter with same priority or something in those lines? – dsomnus Dec 9 '14 at 2:50
  • 1
    All filters are inherently removable (some easier than others, depending on what is used for callback). Consult Codex documentation for starters and don't be quick to jump to “edit everything” mind set. :) – Rarst Dec 9 '14 at 10:00
  • @dsomnus If an answer isn't the solution you went with, please don't tick the "solution"-check mark. Thanks. – kaiser Dec 9 '14 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.