Opened 11 years ago
Closed 9 years ago
#25360 closed enhancement (fixed)
Add a filter in WP_Users_List_Table
Reported by: | juliobox | Owned by: | DrewAPicture |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 3.6 |
Component: | Users | Keywords: | has-patch |
Focuses: | Cc: |
Description
Hello
Can we (i) request a filter in the WP_Users_List_Table class, in the prepare_items() function :
Replace
// Query the user IDs for this page $wp_user_search = new WP_User_Query( $args );
by
// Query the user IDs for this page $args = apply_filters( 'users_list_table_args', $args ); $wp_user_search = new WP_User_Query( $args );
The goal is to hack the query of course.
Thank you
Attachments (1)
Change History (15)
#1
@
11 years ago
- Milestone changed from Awaiting Review to Future Release
- Severity changed from trivial to normal
- Type changed from feature request to enhancement
#5
@
9 years ago
- Keywords needs-docs added
New filters should be documented per the documentation standards.
#7
@
9 years ago
Tested and works well as a filter. The documentation should be addressed as @SergeyBiryukov mentions.
I'm wondering if the filter's should be different, for example, users_list_table_args
and ms_users_list_table_args
Can you create future patches from the root?
#11
@
9 years ago
- Keywords needs-docs good-first-bug needs-refresh removed
@jeremyfelt @roccotripaldi: In [34796], I passed the current list table instance as a second parameter, which should provide the necessary context to properly target the single vs multisite users list tables.
#12
@
9 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
@DrewAPicture - I think we can remove the $this
parameter. Both is_network_admin()
and get_current_screen()
can be used to determine context in a more straight forward way.
Also, blog_id
is available in the original $args
when MS where role
is in the args when single site. That would be a little tougher to rely on, but is there.
A similar filter would be useful in WP_MS_Users_List_Table as well. I opened #25285 to address any user query, but I'd be happy with a filter at the list table level as well.