• Hi i was searching simple autors stats plugin to dashboard, but with no luck.
    So i created dashboard widget:

    // Author stats
    	if ( is_blog_admin() ) {
    		wp_add_dashboard_widget( 'dashboard_authorstats', __( 'Author stats' ), 'wp_dashboard_authorstats' );
    	}
    
    function wp_dashboard_authorstats( $args ) {
    $allUsers = get_users('orderby=post_count&order=DESC');
    $users = array();
    
    // Remove subscribers from the list as they won't write any articles
    foreach($allUsers as $currentUser)
    {
    	if(!in_array( 'subscriber', $currentUser->roles ))
    	{
    		$users[] = $currentUser;
    	}
    }
    
    ?>
    <table>
    <tr><td>
    			<h3 class="authorName"><u>Author</u></h3>
    		</td>
        <td width="20%">
    			<h3 class="authorName"><u>Articles</u></h3>
    		</td></tr>
        </table>
        <?php
    foreach($users as $user)
    {
    $user_post_count = count_user_posts( $user->ID, 'post' );
    	?>
    	<div class="author">
    		<!--<div class="authorAvatar"><?php //echo get_avatar( $user->user_email, '128' ); ?></div>-->
    		<div class="authorInfo">
        <table width="100%">
        <tr><td>
    			<h3 class="authorName"><?php echo $user->display_name; ?></h3>
    		</td>
        <td width="30%">
    			<h3 class="authorName"><?php echo $user_post_count; ?></h3>
    		</td></tr>
        </table>
        </div>
    	</div>
    <?php
    }
    
    }

    And now you can see authors list and number of posts for each author.

  • The topic ‘All authors stats’ is closed to new replies.