nlybe/ratings

Advanced rating and comment functions for Elgg

5.5 2024-02-05 22:49 UTC

This package is auto-updated.

Last update: 2024-11-06 00:27:02 UTC


README

Elgg 5.0

Advanced rating and comment functions for Elgg.

This plugin can replaces the default comment form and with a new one, including star ratings for Elgg objects.

The default comment form of Elgg is not replaced automatically but some custom code can be used in order to show the ratings plugin forms.

How to use it

Returns rendered comments and a comment form for an entity

$vars['rate_label'] = elgg_echo('custom:rate:title');
$vars['comment_label'] = elgg_echo('custom:comment:label');
echo ratings_elgg_view_comments($entity, $add_comment, $vars);

/* @param \ElggEntity $entity      The entity to view comments of
 * @param bool        $add_comment Include a form to add comments?
 * @param array       $vars        Variables to pass to comment view
 */

Display star ratings

elgg_view('ratings/ratings', ['entity' => $entity]);

Improvements

  • Add option to replace the default comment form with ratings form in selected entities
  • Move max value from RatingsOptions to plugin settings in admin area
  • Replace the ratings js component