XF 2.2 Edit Review Resources


Well-known member
There is an add-on from AndyB to edit the message of RM reviews.
Today i have done the add-on for my own as an extension for ResourceReview.
Now i can change the message and rating.

For my next step i need to know how to update the rating for the resource itself.

Is there any fast function like "rebuild rating for resource 123" ?
        $resource = $review->Resource;

        $ratingAvg = $resource->rating_sum / $resource->rating_count;
        $ratingAvg = round($ratingAvg, 2);

            'rating_sum' => $resource->rating_sum,
            'rating_avg' => $ratingAvg

Seems that rebuildRating() only recalculate the sum.
Top Bottom