Opened 12 years ago
Last modified 5 years ago
#23413 new enhancement
Provide query result data to custom user columns
Reported by: | JohnC28 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Users | Keywords: | needs-patch 2nd-opinion |
Focuses: | administration | Cc: |
Description
When the filter manage_users_custom_column is triggered, it sends an empty string for the value field.
Since it's easy enough to extend the WP_User_Query with extra fields, it would be good to have those fields passed through if they exist to save having to requery the database with the user_id parameter to get the data.
I have attached a patch to show what I mean.
Attachments (1)
Change History (4)
#2
@
9 years ago
- Focuses administration added
- Keywords dev-feedback needs-patch added; has-patch removed
We could check to see if anyone used the filter and if not, then use John's proposed solution to backfill the value to avoid the db queries. That preserves backwards compatibility for the couple of plugins that expect the first param to be an empty string while avoiding needless db calls for those who don't use those plugins (the vast majority of WP users).
I guess plugins might expect an empty string. An example:
http://plugins.trac.wordpress.org/browser/document-repository/tags/0.2.4/user-roles.php#L82
Another option might be to pass
$user_object
as the fourth parameter.The filter is also used in
class-wp-ms-users-list-table.php
:http://core.trac.wordpress.org/browser/tags/3.5.1/wp-admin/includes/class-wp-ms-users-list-table.php#L262