I'm trying to do something I assumed would be easy. I assumed wrong. What I want to do is list all the authors of a site on the sidebar, with a link to their respective author page, number of posts written, and gravatar. wp_list_authors doesn't give me an option to include the gravatar at all. Here is what I have
$blogusers = get_users_of_blog();
if ($blogusers) {
foreach ($blogusers as $bloguser) {
$user = get_userdata($bloguser->user_id);
$post_count = count_user_posts($user->ID);
if ($post_count) {
echo '<li>';
echo '<a href="'.get_bloginfo('url').'/author/' . $user->user_nicename . '">'.get_avatar($user->user_email, '36').'</a>';
echo '<a href="'.get_bloginfo('url').'/author/' . $user->user_nicename . '">'.$user->display_name.' ('.$post_count.')</a><li>';
}
}
}
Which works, albeit with two problems:
- I can't find a way to have them sort by number of posts
- the get_users_of_blog is a depreciated function. I really don't want to use it.
I was able to create an explode with wp_list_authors, but didn't have a clue how to extract the data out of it to display in this manner. Help?