WordPress.org

Ready to get started?Download WordPress

Forums

WP-PostRatings
Total scores listed by author (2 posts)

  1. stinkeagle
    Member
    Posted 2 years ago #

    hi, i found this bit of code from the support forums on lester chan's site. that forum has been closed and i can't register or message the creator. wondering if anyone here can help.

    i want the ratings widget to show a list of authors with their total score tallied from all their posts. highest to lowest. as well as another widget for lowest to highest.

    i found this:

    // Show WP-PostRatings Total For Each Author
    function author_rating_total() {
    $user_id = get_the_author_meta( 'ID' );
    $query = array (
    'author' => $user_id,
    'suppress_filters' => 'true',
    'posts_per_page' => -1
    );
    $queryObject = new WP_Query($query); while($queryObject->have_posts()) : $queryObject->the_post();

    $post_ratings_data = get_post_custom(get_the_id());
    $post_ratings_score = intval($post_ratings_data['ratings_score'][0]);

    $ratings_array[] = $post_ratings_score;

    endwhile;

    $ratings_sum = array_sum($ratings_array);

    if ($ratings_sum > 0) {
    $ratings_sum = '+' . $ratings_sum;
    }

    echo $ratings_sum;

    wp_reset_query();
    }

    not sure where to put it and how to get it to show up in my widget. i am a super noob. i tried it in different spots and can't get it right.

    any help would be awesome.

    thanks

    http://wordpress.org/extend/plugins/wp-postratings/

  2. stinkeagle
    Member
    Posted 2 years ago #

    oh, im using the plus minus rating. i have it set where voters can score a post +5 or -5.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic