[wp-trac] [WordPress Trac] #17025: wp_list_authors() is not filterable
WordPress Trac
noreply at wordpress.org
Fri Jun 10 22:08:50 UTC 2022
#17025: wp_list_authors() is not filterable
-------------------------------------------------+-------------------------
Reporter: kevinB | Owner: audrasjb
Type: enhancement | Status: reopened
Priority: normal | Milestone: 6.1
Component: Query | Version:
Severity: normal | Resolution:
Keywords: early needs-dev-note 2nd-opinion | Focuses:
has-patch |
-------------------------------------------------+-------------------------
Changes (by SergeyBiryukov):
* keywords: has-patch early commit needs-dev-note => early needs-dev-note
2nd-opinion has-patch
Comment:
* It seems that the ticket went at some point from filtering the
`wp_list_authors()` query or results to just filtering the full names of
authors, which seems unrelated to the initial request and does not really
address it.
* [attachment:"17025.8.diff"] should probably be reconsidered:
* It needs a new filter name, since it filters not the actual result of
the function, but rather the found users. Maybe
`wp_list_authors_found_users`?
* To avoid a second query, should the function arguments be filtered
instead, as suggested in #55091? Maybe `wp_list_authors_args` then?
* Should `wp_list_users()` get a similar filter for consistency?
* `WHERE post_type = 'post'` should **not** be re-added there, it was
removed in [31653] / #30354 and appears to be a remnant of the earlier
patches.
* There is a translatable string in `wp_insert_user()` for the same
purpose:
{{{
/* translators: 1: User's first name, 2: Last name. */
$display_name = sprintf( _x( '%1$s %2$s', 'Display name based on first
name and last name' ), $meta['first_name'], $meta['last_name'] );
}}}
Perhaps it could be reused here, instead of the full names filter? I'm
not sure the need for a new filter has been demonstrated yet. If some
locales prefer to put the last name first, it seems like the string would
be the way to go. It could then also be reused for the same pattern in
other areas of core:
* [source:tags/6.0/src/wp-admin/includes/class-wp-ms-users-list-
table.php?marks=305#L296 WP_MS_Users_List_Table::column_name()]
* [source:tags/6.0/src/wp-admin/includes/class-wp-users-list-
table.php?marks=571#L565 WP_MS_Users_List_Table::column_name()]
* [source:tags/6.0/src/wp-includes/user.php?marks=830#L822
wp_list_users()]
As it stands, it seems a bit inconsistent to only add a filter for
`wp_list_authors()` but not those other instances.
* If there is a strong reason for the full names filter to stay, should it
be renamed to `wp_list_authors_full_name` (note `authors` instead of
`author`), to match the function name?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/17025#comment:58>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list