Yeap, you are correct. It uses the “My Ratings” $post->ID because the getting of comments ratings is being hooked to loop_start at https://github.com/lesterchan/wp-postratings/blob/master/wp-postratings.php#L331
I am not too sure whether it is possible to show the ratings of each comment. You can try moving the code to get the ratings from get_comment_authors_ratings()
to inside comment_author_ratings_filter()
and play around with the post id.
(@fruitshakes)
9 years, 7 months ago
I created a page called “My Ratings” where users can see the ratings they made.
I removed the slashes in front of
add_filter('comment_text', 'comment_author_ratings_filter');
and then used wp_list_comments and filtered it to show only the logged in user’s comments and hopefully ratings too, like so:And here’s the display_user_ratings callback (mainly based from twentytwelve_comment):
The callback display_user_ratings is successful in listing comments made by the current user showing the post titles, dates, comment texts etc..except for the ratings. All ratings showed that the user did not rate the posts, though the user rated them all.
I think this is primarily because the rating is getting the ratings for the page “My Ratings” instead of showing the ratings for each of the comment.
Is there a way to show the ratings for each comment?
https://wordpress.org/plugins/wp-postratings/