Author Total

This may be a feature request, but am wondering if it's possible now. I am currently only allowing post voting on the single.php page for each post by the different authors. Is there any way that this could be used as a reputation and have a code that could calculate the total number of votes for each author on all of their posts?

  • Philip John
    • DEV MAN’s Apprentice

    Hiya Eric,

    You would be able to do that now with a custom script. You'd need to perform a few database queries to do so.

    First, grab the author then run through their posts, grabbing the number of votes for each post and total them up.

    You could store this total in an option somewhere and then hook into the post voting plugin to update that count each time a vote is submitted.

    Phil

  • Philip John
    • DEV MAN’s Apprentice

    This should be easier as I mentioned in the other thread, so I'll ask Ve to look at this too. I think though that if each post has the votes total in an option you could just do this for author posts by votes;

    <?php
    // grab posts by post count ordered in descending order (most votes first)
    $query = 'author=1&meta_key=wpd&orderby=meta_value&order=DESC';
    $queryObject = new WP_Query($query);
    // The Loop...
    ?>

    Phil

  • Eric G.
    • The Crimson Coder

    Great! I will wait to see what Ve says about this one before I throw some code up on what I have so far. I have set up the author page though. You will see I will be pulling three different sets of posts on the page then. One with their current regular posts. One with their custom post types (shopproducts). And now one to pull in the total votes in the top right corner.

    Thanks in advance for all your help.

  • Philip John
    • DEV MAN’s Apprentice

    Hiya,

    Just checking if it was eventually resolved in another thread? Or by yourself separately to us? Or by us over email with you? Or using our live support?

    If so, no need to reply, that's great news.

    If not, could you let us know by re-opening this topic, and we'll get onto it and helping you out asap!

    Otherwise, happy days, glad you got it sorted :slight_smile:

    Cheers,
    Phil

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.