When trying to get top rated posts for an author:
$args=array( 'author'=>$author_id, 'posts_per_page'=>5, 'exclude'=>$exclude, 'gdsr_sort'=>'rating', //! 'gdsr_order'=>'desc', //! 'gdsr_fsvmin'=>1, //! ); $result=new WP_Query($args); return $result->get_posts();
The folowing SQL is generated:
SELECT SQL_CALC_FOUND_ROWS wp_posts.*, (gdsra.user_votes + gdsra.visitor_votes)/(gdsra.user_voters + gdsra.visitor_voters) as gdsr_rating, (gdsra.user_recc_plus - gdsra.user_recc_minus + gdsra.visitor_recc_plus - gdsra.visitor_recc_minus) as gdsr_thumb_score, (gdsra.user_voters + gdsra.visitor_voters) as gdsr_votes, (gdsra.user_recc_plus + gdsra.user_recc_minus + gdsra.visitor_recc_plus + gdsra.visitor_recc_minus) as gdsr_thumb_votes, gdsra.review as gdsr_review, gdsra.last_voted as gdsr_last_voted FROM wp_posts LEFT JOIN wp_gdsr_data_article gdsra ON gdsra.post_id = wp_posts.ID WHERE 1=1 AND (wp_posts.post_author = 5) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') ORDER BY (gdsra.user_votes + gdsra.visitor_votes)/(gdsra.user_voters + gdsra.visitor_voters) desc, (gdsra.user_voters + gdsra.visitor_voters) desc, wp_posts.post_date desc LIMIT 0, 5
You can see that the 'exclude' and 'gdsr_fsvmin' from $args are basically unexpectedly ignored (especially 'exclude', which is not part of GDSR). This causes the script to return non-rated posts, and include unwanted posts. Also, I get some performance worries looking at that query.
This is a fabulous plugin, which obviously took a lot of time and effort to code, but REALLY needs a strong API and documentation.
I mean, getting top rated posts from a user programmatically should really be very straight forward and trivial, something on the lines of
Yet this complex plugin lacks this basic functionality. If it actually had more advanced statistics functions, it would be awesome.
Well, waiting for v2.0, I guess.
Thanks for this plugin, anyway.