From 48c2508bdbd399cda24c41e82bbab5f22edb3882 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 14 Aug 2019 14:29:23 -0400 Subject: [PATCH] make search result html output filterable Allows the html output of the search results to be altered for each user result. Example use case: adding the first and last name of the user to the result. --- admin-bar-user-switching.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/admin-bar-user-switching.php b/admin-bar-user-switching.php index b30a759..864ca86 100644 --- a/admin-bar-user-switching.php +++ b/admin-bar-user-switching.php @@ -175,7 +175,8 @@ function abus_user_search() { $link = user_switching::maybe_switch_url( $user ); if ( $link ) { $link = add_query_arg( 'redirect_to', apply_filters( 'abus_switch_to_url', $url ), $link ); - echo '

' . $user->display_name . '

'; + $result_html = '

' . $user->display_name . '

'; + echo apply_filters( 'abus_user_result_element', $result_html, $link, $user ); } } @@ -241,4 +242,4 @@ function abus_styles() { } add_action( 'wp_head', 'abus_styles' ); -add_action( 'admin_head', 'abus_styles' ); \ No newline at end of file +add_action( 'admin_head', 'abus_styles' );