WordPress.org

Make WordPress Core

Opened 17 months ago

Closed 5 weeks ago

Last modified 3 weeks ago

#47685 closed enhancement (fixed)

Allow developers to filter the authors list on quick edit dropdown

Reported by: Mista-Flo Owned by: SergeyBiryukov
Milestone: 5.6 Priority: normal
Severity: normal Version:
Component: Quick/Bulk Edit Keywords: has-patch needs-dev-note commit
Focuses: administration Cc:

Description

Hello,

I want to find a way to filter the author list displayed in quick edit dropdown. I basically want to remove some roles of this list.

But there is currently no hook so I have to go through the wp_dropdown_users function, then use wp_dropdown_users_args filter, but this functions is also called on a lot of other parts of the backend, so I have to be sure that I'm only affecting the quick edit query.

So it would be nice to just add a particular filter for this quick edit author dropdown.

Attachments (4)

47685.1.patch (991 bytes) - added by Mista-Flo 17 months ago.
47685.2.patch (1022 bytes) - added by Mista-Flo 3 months ago.
47685.3.diff (977 bytes) - added by garrett-eclipse 5 weeks ago.
Minor refresh to improve the filter docblock and rename it quick_edit_dropdown_authors_args to coincide with the existing quick_edit_dropdown_pages_args filter.
47685.3-10192020-1803.gif (2.8 MB) - added by hellofromTonya 5 weeks ago.
Screen capture showing before filter is applied and when filtering 'rolein' => array( 'editor', 'administrator' ).

Change History (18)

@Mista-Flo
17 months ago

#1 @Mista-Flo
17 months ago

  • Keywords has-patch added; needs-patch removed

#2 @SergeyBiryukov
15 months ago

  • Milestone changed from Awaiting Review to 5.3
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#3 @davidbaumwald
14 months ago

  • Keywords commit added

@SergeyBiryukov Can this one be moved forward for version 5.3 Beta 1 tomorrow? The patch looks clean. Would this need a small Dev Note as well?

#4 @davidbaumwald
14 months ago

  • Keywords commit removed
  • Milestone changed from 5.3 to Future Release

With 5.3 Beta 1 being released today, I’m punting this to Future Release.

@Mista-Flo
3 months ago

#5 @Mista-Flo
3 months ago

Hey @SergeyBiryukov I have updated my patch so it will be applied with last version of trunk. Hopefully it can now be part of 5.6 release :)

#6 @SergeyBiryukov
3 months ago

  • Milestone changed from Future Release to 5.6

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


3 months ago

#8 @hellofromTonya
3 months ago

  • Keywords needs-dev-note added

New filter. Tagging for a mention in the general dev note.

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


7 weeks ago

@garrett-eclipse
5 weeks ago

Minor refresh to improve the filter docblock and rename it quick_edit_dropdown_authors_args to coincide with the existing quick_edit_dropdown_pages_args filter.

#10 @garrett-eclipse
5 weeks ago

  • Keywords needs-testing added

Thanks for the enhancement @Mista-Flo I've refreshed your patch in 47685.3.diff to slightly improve the docblock and rename the filter quick_edit_dropdown_authors_args (previously quick_edit_authors_query_args) to coincide with the existing quick_edit_dropdown_pages_args filter.

I think this just needs some testing on the latest patch and it's ready for committers review.

@hellofromTonya
5 weeks ago

Screen capture showing before filter is applied and when filtering 'rolein' => array( 'editor', 'administrator' ).

#11 @hellofromTonya
5 weeks ago

  • Keywords commit added; needs-testing removed

Tested with this code:

<?php

add_filter( 'quick_edit_dropdown_authors_args', function ( $users ) {
        $users['role__in']                = [ 'editor', 'administrator' ];
        $users['who']                     = '';
        $users['hide_if_only_one_author'] = false;

        return $users;
} );

Works as expected.

Removing needs-testing. This ticket is ready for commit.

#12 @Mista-Flo
5 weeks ago

Thanks for the test @hellofromTonya, looks good to me as well, thanks for the refresh @garrett-eclipse

#13 @SergeyBiryukov
5 weeks ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 49238:

Quick/Bulk Edit: Introduce quick_edit_dropdown_authors_args filter.

This allows for customizing the arguments used to generate the Quick Edit authors drop-down.

Additionally, pass the $bulk argument to the quick_edit_dropdown_pages_args filter, for consistency.

Props Mista-Flo, garrett-eclipse, hellofromTonya.
Fixes #47685.

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


3 weeks ago

Note: See TracTickets for help on using tickets.