While writing up a tutorial for the upcoming WP Roots.com, I put together this quick widget that can be used to display a list of your blog authors, including gravatars and post counts.
A greatly enhanced version of this plugin is available here
So, as the code was complete, I figured I might as well drop it into a quick plugin and make it available for all of you
Download the plugin below and let me know what you think!
Download
I really like the simplicity of this widget. I’ve noticed now that subscribers are registering on my site, they’re also appearing in the list. I’d like to be able to confine it to “contributors” and “admins” (basically anyone that makes posts on the site, not normal subscribers or or people who comment).
Is there an easy way to make this exclusion?
Thanks!
@davincikittie – Yes, you can add a simple parameter to the author query to prevent it from pulling certain user levels.
So add something like this to the query: WHERE user_level != 2
Thanks for the quick reply! When I added the extra code to the query, all users disappeared from the widget. I checked the DB and there’s no user_level column in the users table. I found the user_level information in the usermeta table, but it was part of the meta data.
@Davincikittie – Oh shoot, you’re right, sorry. It will actually be a bit more difficult to exclude certain user levels. I’m planning to add that feature to the Advanced version today or tomorrow.
Great! Looking forward to it. =)
Will you reply here when it’s ready so I don’t keep checking back impatiently?
Please tell me how can i call it ???
Once activated, the plugin will create a new Widget in the “Appearance > Widgets”. You can place it in any widgetized area.
Hi , i have the same problem. ok if name is admin, but if i’m the administrator and don’t write anything on the client blog, my name i.e. Maurizio is display on the widget like this Maurizio (0), and this’s not right!!!
i solve it like this: if users have no post i don’t display him…
i add this code : if (count_user_posts($author->ID) != 0) {
after line 45: $author_info = get_userdata($author->ID);
and this code: }
after line 58: echo ”;
maybe this two simple line can be added to the next version plugin..
bye from Italy
Maurizio
Thanks for the suggestion. I will check it.
Hi I just installed the plugin, the problem I had is that the authors wanted to sort by number of post, reviewing the documentation ( http://codex.wordpress.org/Function_Reference/get_users )modify the plugin as follows:
$authors = get_users( array(
'who' => 'authors',
'number' => 99999,
'orderby' => 'post_count',
'order' => 'DESC'
) );
I think that would be a good feature to include sorting option in the plugin:
‘display_name’ or ‘post_count’.
I added the feature to sort by number of posts, I made a change file that I would like to integrate these, please check:
https://gist.github.com/3861150
Looks great! Thanks for posting!
Hello,
)
very usefull tutorial for me, but I found one error in a source code. If You want the option “gravatar” work You should replace line 51 with condition “if($gravatar) echo get_avatar($author->ID, 40);”. Unless You did not correct this lineg gravatars will show every time
Thanks Pippin.