Networks and Sites: Introduce the ms_user_list_site_class filter.

In the network admin user table on multisite installs (`WP_MS_Users_List_Table`), this filter allows the classes for the `<span>` tag surrounding each site link to be modified.

Props kraftbj, flixos90, johnjamesjacoby.
Fixes #41146.
Built from https://develop.svn.wordpress.org/trunk@44977


git-svn-id: http://core.svn.wordpress.org/trunk@44808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2019-03-21 23:55:51 +00:00
parent 8dcd3a09a8
commit 36af5473be
2 changed files with 20 additions and 3 deletions

View File

@ -337,8 +337,25 @@ class WP_MS_Users_List_Table extends WP_List_Table {
continue;
}
$path = ( $val->path === '/' ) ? '' : $val->path;
echo '<span class="site-' . $val->site_id . '" >';
$path = ( $val->path === '/' ) ? '' : $val->path;
$site_classes = array( 'site-' . $val->site_id );
/**
* Filters the span class for a site listing on the mulisite user list table.
*
* @since 5.2.0
*
* @param array $site_classes Class used within the span tag. Default "site-#" with the site's network ID.
* @param int $site_id Site ID.
* @param int $network_id Network ID.
* @param object $user WP_User object.
*/
$site_classes = apply_filters( 'ms_user_list_site_class', $site_classes, $val->userblog_id, $val->site_id, $user );
if ( is_array( $site_classes ) && ! empty( $site_classes ) ) {
$site_classes = array_map( 'sanitize_html_class', array_unique( $site_classes ) );
echo '<span class="' . sanitize_html_class( implode( ' ', $site_classes ) ) . '">';
} else {
echo '<span>';
}
echo '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $val->userblog_id ) ) . '">' . str_replace( '.' . get_network()->domain, '', $val->domain . $path ) . '</a>';
echo ' <small class="row-actions">';
$actions = array();

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.2-alpha-44976';
$wp_version = '5.2-alpha-44977';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.