Make WordPress Core

Opened 6 years ago

Last modified 5 years ago

#43680 reviewing enhancement

Add new filter to WP_User_Query

Reported by: spacedmonkey's profile spacedmonkey Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: Future Release Priority: normal
Severity: normal Version: 3.1
Component: Users Keywords: has-patch needs-testing
Focuses: Cc:

Description

Add a new filter to filter the value of results returned from the WP_User_Query. This brings the WP_User_Query class inline with other query classes, like WP_Query, which already has posts_results filter. This filter is a powerful one, that will allow for third party code, to hook in and change the results of the query.

Attachments (3)

43680.diff (752 bytes) - added by spacedmonkey 6 years ago.
43680.2.diff (750 bytes) - added by spacedmonkey 6 years ago.
43680.3.diff (1.6 KB) - added by SergeyBiryukov 5 years ago.

Download all attachments as: .zip

Change History (11)

@spacedmonkey
6 years ago

#2 @SergeyBiryukov
6 years ago

  • Milestone changed from Awaiting Review to 5.0

#3 @danieltj
6 years ago

  • Focuses performance removed
  • Keywords needs-testing added
  • Type changed from defect (bug) to enhancement

Removing the performance focus and converting from bug to enhancement as nothing is technically broken here.

@spacedmonkey
6 years ago

#4 @spacedmonkey
6 years ago

Updated the patch with coding standard fixes. cc @SergeyBiryukov

#5 @SergeyBiryukov
6 years ago

  • Milestone changed from 5.0 to 4.9.9
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#6 in reply to: ↑ description @SergeyBiryukov
5 years ago

Replying to spacedmonkey:

Add a new filter to filter the value of results returned from the WP_User_Query. This brings the WP_User_Query class inline with other query classes, like WP_Query, which already has posts_results filter.

For consistency with the posts_results filter, which accepts an array of WP_Post objects rather than stdClass objects, I guess I would expect users_results to accept an array of WP_User objects.

What do you think of 43680.3.diff? It runs the filter a bit later, after converting the results to WP_User objects when fields is all or all_with_meta, but before retrieving metadata via cache_users().

#7 @pento
5 years ago

  • Milestone changed from 4.9.9 to Future Release
Note: See TracTickets for help on using tickets.