• Resolved evilbeet

    (@evilbeet)


    I’m looking for a plugin that will allow me to tell how many posts each one of my authors/editors/etc has published each month. I’ve looked around for one and not had any luck finding one. Can someone recommend such a plugin?

    If not, I’d appreciate suggestions for how I can use the SQL database to extract this data. What would be the appropriate query?

    Thanks in advance!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter evilbeet

    (@evilbeet)

    Just thought I’d try a bump?

    Using wpdb with something like this will get you close

    $mytitles = $wpdb->get_results(“
    SELECT COUNT(*), $wpdb->posts.post_author,YEAR($wpdb->posts.post_date), MONTH($wpdb->posts.post_date)
    FROM $wpdb->posts
    WHERE 1=1
    AND $wpdb->posts.post_type = ‘post’
    AND $wpdb->posts.post_status = ‘publish’
    GROUP BY $wpdb->posts.post_author, LEFT($wpdb->posts.post_date, 7)
    “);

    Cleaned up a bit–didn’t test this too much:

    <?php
    $results = $wpdb->get_results("
    SELECT COUNT(*), $wpdb->posts.post_author,YEAR($wpdb->posts.post_date), MONTH($wpdb->posts.post_date)
    FROM $wpdb->posts
    WHERE 1=1
    AND $wpdb->posts.post_type = 'post'
    AND $wpdb->posts.post_status = 'publish'
    GROUP BY $wpdb->posts.post_author, LEFT($wpdb->posts.post_date, 7)
    ",ARRAY_N);
     foreach ($results as $result) {
      echo '<p>author id '.$result[1] . ' has '.$result[0] . ' posts in '.$result[3] . '/'.$result[2] . '</p>';
      }
    
    ?>
    Thread Starter evilbeet

    (@evilbeet)

    This worked!!! Thank you thank you!!!! And THANK YOU again!!

    I am also looking for the same. Where can i paste this code to get it done. need to create a new file? or add it in function.php?
    thanks in adv.

    any suggestion, if i can plug it to dashboard. how can i?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Need Way to Track Monthly Posts by Author’ is closed to new replies.