is_numeric( $q ) ? $q : '*' . $q . '*',
)
);
// Query the users
$userQuery = new WP_User_Query( $args );
$html .= '
';
// Check whether we have results returned
if ( ! empty( $userQuery->results ) ) {
/**
* Loop through each returned user
*
* @var WP_User $user
*/
foreach ( $userQuery->results as $user ) {
// If this user is the current user - skip to next user
if ( $user->ID == get_current_user_id() ) {
continue;
}
if ( $link = user_switching::maybe_switch_url( $user ) ) {
$link = add_query_arg( 'redirect_to', apply_filters( 'abus_switch_to_url', $url ), $link );
$html .= '
' . $user->display_name . '
';
}
}
} else {
$html .= '
' . __( 'No users found.', 'abus' ) . '
';
}
$html .= '
';
wp_send_json($html);
}
}