Display author data (exclude lower roles)
-
I want to create a list of the authors in my multi-author blog, and display the number of posts they published this month and the number of comments on those posts.
I was able to get the following:
<table> <tr><th>User</th><th>Post Count</th></tr> <?php //displays users along with count of posts each user has belonging to current month $current_month = date('m'); $current_year = date('Y'); $blogusers = get_users_of_blog(); if ($blogusers) { foreach ($blogusers as $bloguser) { $user = get_userdata($bloguser->user_id); $userposts = get_posts('year=' . $current_year . '&monthnum=' . $current_month . '&author=' . $bloguser->user_id); $count=count($userposts); echo '<tr><td>User ID ' . $user->ID . ' ' . $user->display_name . '</td><td> '. $count .'</td></tr>'; } } ?> </table>
However, I can’t figure out how to exclude non-authors (like the “subscriber” role) from this list. I also need some help aggregating the number of comments on those posts to add to another table column. Any thoughts? Thanks in advance!
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘Display author data (exclude lower roles)’ is closed to new replies.