WordPress.org

Make WordPress Core

Opened 6 months ago

Last modified 7 weeks ago

#45954 new feature request

Add a extra_tablenav() method to WP_MS_Sites_List_Table

Reported by: pbiron Owned by:
Milestone: 5.3 Priority: normal
Severity: normal Version: 5.1
Component: Networks and Sites Keywords: has-screenshots has-patch
Focuses: administration, multisite Cc:

Description

With blogmeta landing in 5.1-beta1 (#37923 and #40229) it would be really sweet if WP_MS_Sites_List_Table had an extra_tablenav() method which fired restrict_manage_sites and manage_sites_extra_tablenav actions (analogous to WP_Posts_List_Table's restrict_manage_posts and manage_posts_extra_tablenav).

This would allow plugins to add dropdowns (or other UI components) to limit the sites shown in the list table to those that have specific values in blogmeta (just like is now possible with other WP_List_Table sub-classes).

I'm currently developing a large multisite (2000-3000 sites). The main site will serve as a directory of places of worship (searchable on the front-end by denomination and various other characteristics; blogmeta is going to make that searching much easier than it otherwise would have been!). Each place of worship will be a site in the network.

Having WP_MS_Sites_List_Table::extra_tablenav() would make the site admin's job a lot easier, as it would allow them to perform some bulk action on just those sites with a specific denomination, etc. I'll add a screenshot of a mockup once I finish creating this ticket.

I raised the possibility of this feature a few weeks ago in #core-multisite at a time when I didn't think blogmeta was going to land. I know that technically now that 5.1-beta1 is out there are not supposed to be enhancements or feature requests added...but I'm hoping we can bend the rules a little and get this in beta2. If that is possible, I can have a patch ready in a few days.

Attachments (3)

restrict_manage_sites.png (45.7 KB) - added by pbiron 6 months ago.
mockup of a use of the proposed 'restrict_manage_sites' action
49594.diff (2.8 KB) - added by pbiron 5 months ago.
45954.2.diff (2.8 KB) - added by pbiron 7 weeks ago.
same as 45954.diff but with @since updated to 5.3.0.

Download all attachments as: .zip

Change History (20)

@pbiron
6 months ago

mockup of a use of the proposed 'restrict_manage_sites' action

#1 @pbiron
6 months ago

  • Keywords has-screenshots added

#2 @pbiron
6 months ago

  • Version set to trunk

#3 @pento
6 months ago

  • Milestone changed from Awaiting Review to Future Release

Thank you for the suggestion, @pbiron! It's too late for 5.1, but if you want to put a patch together, we can look at it for 5.2. 🙂

#4 @pbiron
6 months ago

Yeah, I figured it was too late, but didn't hurt to ask.

I've got the basic patch ready, but since it's not needed immediately, I'll work on it a little more before posting it...including adding unit tests.

This ticket was mentioned in Slack in #core-multisite by pbiron. View the logs.


5 months ago

@pbiron
5 months ago

#6 @pbiron
5 months ago

49594.diff adds the WP_MS_Sites_List_Table::extra_table() method and the new restrict_manage_sites and manage_sites_extra_tablenav filters. It also changes /wp-admin/network/sites.php to process submissions of the "Filter" button.

I've been using (some version of) this patch since the first 5.1-beta came out on a couple of in development multisites and haven't noticed any problems.

#7 @pbiron
5 months ago

  • Keywords has-patch added

#8 @pbiron
5 months ago

I was planning on adding some unit tests, but discovered there are no tests for the equivalent filters provided by other list tables so I didn't bother with any here.

The only tests I can find related to extra_tablenav() are for WP_Posts_List_Table (e.g.,
Tests_Admin_includesListTable::test_filter_button_should_not_be_shown_if_there_are_no_posts(), etc). I could add a test similar to those that checks that the "Filter" button is present if nothing hooks into the new filters, but I don't think that is really necessary.

This ticket was mentioned in Slack in #core-multisite by pbiron. View the logs.


5 months ago

This ticket was mentioned in Slack in #core-multisite by pbiron. View the logs.


4 months ago

This ticket was mentioned in Slack in #core by pbiron. View the logs.


4 months ago

This ticket was mentioned in Slack in #core-multisite by pbiron. View the logs.


4 months ago

This ticket was mentioned in Slack in #core-multisite by pbiron. View the logs.


2 months ago

This ticket was mentioned in Slack in #core-multisite by spacedmonkey. View the logs.


7 weeks ago

#15 @spacedmonkey
7 weeks ago

  • Keywords needs-refresh added
  • Milestone changed from Future Release to 5.3

@pbiron It is time for this to go into core. Can you update the since, I will see if I can get this merged.

#16 @pbiron
7 weeks ago

sure...I'll try to get to that later today.

@pbiron
7 weeks ago

same as 45954.diff but with @since updated to 5.3.0.

#17 @pbiron
7 weeks ago

  • Keywords needs-refresh removed

45954.2.diff is the same as 45954.diff but with @since updated to 5.3.0.

Note: See TracTickets for help on using tickets.