// retrieve latest 5(or all) posts of this user
$query = new WP_Query(array(
'author' => $author,
'posts_per_page' => 5
));
// skip the user if the number of posts is 0
if($query->post_count < 1)
continue;
// loop through available posts & display the title
while($query->have_posts()) :
$query->the_post();
the_title();
endwhile;
wp_reset_query();
This code should go inside the your foreach loop