by bourgesloic on WordPress.org
Easy-to-use plugin to manage star rating reviews on your posts or custom posts. Built on Wordpress comments functionalites. Neat and hasslefree.

Example of review management on a single post page
The “Post Rating and Review” plugin offers the possibility to connected visitors to review posts or types of posts that you have created (custom post types). You may define the rating scale yourself.
You can use the plugin in 2 ways:
These features are mainly usable with shortcodes, so without development. Three shortcodes are integrated into the plugin allowing the display of 3 different widgets:
Enabling review management will automatically display the “rating chart” widget above the list of comments in a single post page without the need of a shortcode. Additionally, you can integrate other widgets on the same page if you wish (for instance, a widget “display rating” at the top of the page).
The plugin also includes functionalities to manage email notification to posts authors when a new review of their post is submitted.
This plugin integrates schema.org specifications on ratings: microdata will be automatically generated when you display the overall rating of a post (“aggregateRating” type).
An important point: in this first version, the plugin allows rating only for visitors connected to your site, which seems to us to be the best choice to manage reviews on a website. Nevertheless, a future update may integrate the management of ratings and reviews by non-connected visitors if needed.
I developed this plugin for my own use and then made it as configurable as possible so that it could be used by others. Do not hesitate to contact me if you are missing certain features. I can’t promise you that I will be able to integrate them into a future release for you, but it doesn’t hurt to ask!
You can access and customize the following parameters:
Enable review management? : if yes, the management of reviews will be activated. Then choose the type or types of post for which you want to activate this management of reviews. Then indicate which fields are mandatory for a visitor to be able to submit their review (N.B. at least one of the 2 fields must be selected as mandatory).
You can also indicate if a review author have the possibility to modify and/or delete its review (N.B. it applies until review has not been answered). Last, you can allow modifying review in WP backoffice by another user that review author.
Three shortcodes display a Rating widget. You can integrate these shortcodes in several ways: in the Gutenberg editor, in the Classic Editor, in a widget or even directly in your templates.
You can also integrate several rating widgets on the same page: for example, if you integrate the shortcode at the top and bottom of the page, the validation of the rating with one of rating widgets will trigger the update of the other widgets present on the page.
[prar_set_rating_for_post]
Optional parameters accepted in the shortcode:
Example:
[prar_set_rating_for_post post_id="153" step="0.5" size="32" update_after_vote="false"]
[prar_display_rating_for_post]
Optional parameters accepted in the shortcode:
Example:
[prar_display_rating_for_post post_id="153" size="32" display_compteurs="true"]
[prar_display_rating_chart_for_post]
Optional parameters accepted in the shortcode:
Example:
[prar_display_rating_chart_for_post post_id="153" size="20"]
Managing reviews consists of associating a rating with a comment. The reviews management uses WordPress commenting functionalities: therefore, comments must be activated for the types of post for which you want to activate reviews.
Thanks to the use of standard WP features, the settings you specify for comments will automatically apply to reviews (manual approval of comments, notification messages, automatic moderation, etc.).
The settings that will not apply to review management are:
To enable reviews, indicate “yes” in the plugin options (“Reviews management settings” section) then select the post types for which you want the review management features to be automatically implemented.
When you activate this management of reviews, the standard “Comments” area will be replaced by a plugin owned template (“post-reviews.php”) which is located in the “includes/template” folder of the plugin. You can also customize this template by copying it into a “prar-rating” folder in your theme.
This template displays the overall rating, the detailed rating chart, the list of reviews already published as well as a button allowing a visitor to leave a new review. This button is active if the visitor is logged in and has not already left a review on the post. The writing of the review by the visitor is done in a popin which combines the rating attribution and the comment left by the visitor. Via the options of the plugin, it is possible to determine if the note and/or the comment are mandatory to leave a review.
Reviews left by users will be visible in admin in the standard WordPress comments list as well as on the post editing page.
You can activate a functionality which will send emails to post authors each time a new rating or a new review of their post is submitted.
email-author-notification-new-review_en_US.txt (en_US can be changed with your locale if you want to translate it to your language).email-author-notification-new-rating_en_US.txt.Both emails are in plain-text format. You can customize these emails copying txt template in a “prar-rating” folder in your theme directory, then change the locale if you need (for instance, email-author-notification-new-rating_de_DE.txt if your website is in german language). Text between {} shall not be changed: it will be replaced dynamically by values when the email is generated.
Several hooks are available for developers as well as callable functions:
prar_rating_before_save_notepost_id, user_id, note, external_idprar_rating_after_save_notepost_id, user_id, note, external_idprar_rating_tpl_reviews_begin_headerprar_rating_tpl_reviews_before_add_reviewprar_rating_tpl_reviews_after_add_reviewprar_rating_tpl_reviews_end_headerprar_rating_tpl_have_reviews_startprar_rating_tpl_have_reviews_endprar_rating_tpl_no_reviews_startprar_rating_tpl_no_reviews_endprar_rating_sc_set_note_attsarray attsprar_rating_text_save_user_noteinitial text, note, post_idprar_rating_text_user_noteinitial text, note, post_idprar_rating_html_block_user_noteinitial html block, note, post_idprar_rating_html_block_display_noteinitial html block, array with overall note information (number_of_notes, note, sum_notes)prar_rating_notification_new_review_email_subjectsubject, comment (object)prar_rating_notification_new_review_email_headerheader, comment (object)prar_rating_notification_new_rating_email_subjectsubject, blogname, post (object), rating (array)prar_rating_notification_new_rating_email_sendersender, blogname, post (object), rating (array)prar_rating_notification_new_rating_email_fromfrom, blogname, post (object), rating (array)prar_rating_notification_new_rating_email_headerheader, blogname, post (object), rating (array)prar_rating_can_review_be_updatedcan_be_uptdated (boolean), comment (object)prar_rating_get_average_note_for_postpost_id, user_id, external_idprar_rating_get_average_note_for_useruser_idprar_rating_get_average_note_for_external_idexternal_idprar_rating_get_all_notes_for_useruser_idprar_rating_get_all_notes_for_postpost_idprar_rating_get_all_notes_for_external_idexternal_idtrigger("prar_rating_saved")"prar_set_rating_for_post" widget. It is not generated as part of the management of reviews for which the note is recorded after validation of the complete form.prar_rating_display_starsThe development of this plugin was greatly facilitated by “RaterJS” javascript library developed by Fredrik Olsson. Many thanks also to Eric for his valuable design advices and feature ideas.