WordPress.org

Support

Support » Plugins and Hacks » [Plugin: WP-PostRatings] Total scores listed by author

[Plugin: WP-PostRatings] Total scores listed by author

  • 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/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: WP-PostRatings] Total scores listed by author’ is closed to new replies.