For a soon-to-be launching client project I needed the Wordpress built in search to return, not just post and page content, but also users that match the users query string. I couldn’t find a plugin that facilitated this so put together the following code snippet to handle it:
<?
$authors = $wpdb->get_results('SELECT * FROM '.$wpdb->users.' WHERE user_login LIKE "%'.urldecode($_GET['s']).'%"');
if(!empty($authors)){
?>
<h2>Authors matching your query</h2>
<?
foreach($authors as $author){
$bio = $wpdb->get_results('SELECT * FROM '.$wpdb->usermeta.' WHERE user_id="'.$author->ID.'" AND meta_key="description"');
$bio = $bio[0]->meta_value;
?>
<div class="search-result">
<h3><?=$author->user_login?></h2>
<?=apply_filters('the_content', $bio)?>
</div>
<?
}
?>

