[wp-trac] [WordPress Trac] #41146: Add filter for a site's class (WP_MS_Users_List_Table)
WordPress Trac
noreply at wordpress.org
Mon Jun 26 20:04:00 UTC 2017
#41146: Add filter for a site's class (WP_MS_Users_List_Table)
--------------------------------+------------------------------
Reporter: kraftbj | Owner: kraftbj
Type: enhancement | Status: accepted
Priority: normal | Milestone: Awaiting Review
Component: Networks and Sites | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses: administration
--------------------------------+------------------------------
Comment (by flixos90):
@kraftbj
> I'm only checking for `is_array` to make sure the return is in the right
format.
I think we can even strip this out, as it's commonly expected to return
the same type that is passed to a filter as the filtered parameter.
Similar filters in core do not check this either.
> We could also check for an empty array, but I don't want to overengineer
it.
Right, I don't think that's necessary, especially since the default isn't
empty either.
There are just a few (mostly naming) changes I'd like to suggest:
* The variable could be called `$site_classes` to indicate that we're
dealing with multiple classes (also makes it more obvious that it's an
array).
* While the site ID property is called `$userblog_id` (for legacy
reasons), let's use a more appropriate name in the filter documentation
(for example `$site_id`). The name is independent of the actual passed
parameter anyway since it's a property.
* It might be useful to pass the network ID (as saved in the `$site_id`
property) to the filter as well, since that is also used in the default
class. Similar to the above, the docs should probably call it
`$network_id`.
* Not very important, but I'd preferably use `implode()` instead of
`join()` just because it is the actual and more commonly used PHP
function, and since it aligns better with its counterpart `explode()`.
* Last but not least, let's look at the name of the filter
`ms_user_list_site_class` for a bit longer. I'm not sure whether it's
appropriate/precise enough. I'm not opposed to the current name, just
something to think about further.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41146#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list