WordPress.org

Ready to get started?Download WordPress

Forums

Need help dealing with MySQL query results to determine popular blog authors (1 post)

  1. johngorenfeld
    Member
    Posted 4 years ago #

    Hey everyone. I’m trying to write a plugin that figures out which blog authors are the most popular contributors. But I am still learning MySQL and would really appreciate some help.

    So my basic idea was to start with an existing plugin called WordPress Popular Posts. This plugin collects pageview data and leaves it in the WordPress database under wp_popularpostsdata.

    I’ve been trying to compile that information and sort it by author. I’ve been doing that using this query, but there might be a better way to do it:

    SELECT *, SUM(pageviews) FROM wp_posts, wp_popularpostsdata, wp_users WHERE wp_posts.ID=wp_popularpostsdata.postid AND post_status=‘publish’ AND post_type=‘post’ GROUP BY post_author

    But then when I run the query, I am not sure how to display or parse the results. I’ve been trying different things using the global $wpdb object.

    What would the next step be? Any help much appreciated. Or alternative methods.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.