Topic Ratings Plugin

(Non-technical User) #41

Hey I love this plugin. Thanks for the good work. How about showing the rating on hover over the stars in each topic / posts? For example can show 3.5 or 4.2 numbers based on average rating. I have the Show exact average rating setting turned on.

(Angus McLeod) #42

Sorry for the slow reply, I’ve been away.

Just to clarify, you are seeing the numerical average next to the topic rating right?

Could you show me a mockup or an example of what you have in mind? Cheers.

(Non-technical User) #43

Yes, I see the average. That’s fine. What I have in mind is a like hover on small title popup showing the average on the main topics list view. In that screen you see a rating but on hover does not show the average. For example, a 3.5 rating is showing as 4 stars and on hover does not give out the average. I have to enter that topic to view the average. Understand it is not a big deal to have it as it is, just thought since we are accustomed to hovering over star ratings on many websites to see the average score, it may be a good feature to implement for habitual reasons.

(Non-technical User) #44

When the topic creator has chosen no rating for a topic, why don’t we suppress the need to either add a rating or uncheck the box for replies? We can just hide the ratings field for the replies right?

(Angus McLeod) #45

I’ve added exact averages to topic list items in the same format as in the topic title.

I didn’t do the Amazon-style hover (yet) because a hover element typically holds more content than just a single number (unless it’s a tooltip), and I’ll need to decide what else to include there first.

One option is to add the percentages for the different star options like Amazon does (see below).

Also, I had a brief look around at other popular sites using star ratings. It seems a majority display the number of ratings after the stars, with a minority showing the exact average. Not many show anything on hover.

Were there any other specific examples you had in mind?

(Angus McLeod) #46

Could you give a little more info for this scenario:

  1. Is the topic in a category with ratings turned on and/or has a ‘rating’ tag?

  2. Which ratings ‘field’ are we hiding?

(Non-technical User) #47

Yes, the topic is in a category with ratings turned on. I will give you an example.

As a topic creator, I post a new topic under this category but uncheck ratings while posting it.

Now another user is replying to this topic without ratings (but under a category with ratings enabled)

The user has to now again either uncheck ratings while posting his reply or has to add a rating.

I wonder if we can (or should) suppress the need to add/uncheck a rating for replies to a topic which the owner of the topic has not set ratings to. I cannot think of any scenario where it may be needed to add a rating to a reply for an original topic without ratings.

(Repz) #48


I triied to install this plugin but seems like something is wrong, i can’t rate a topic and got this in error logs :slight_smile:

Error: Could not find module `discourse/helpers/register-unbound` imported from `discourse/plugins/discourse-ratings/discourse/initializers/ratings-edits`
    at o (
    at i (
    at n.state (
    at e (
    at requireModule (
    at Array.forEach (native)
    at window.Discourse.Ember.Application.extend.start (

(Angus McLeod) #49

@repz I just updated this plugin to work with the latest Discourse code. Please try again. Thanks.

(Repz) #50

@angus working like a charm!

Thanks a lot :wink:

(Simon Cossar) #51

This is great! I’d like to use it with the Discourse WordPress plugin so that WooCommerce (a WordPress ecommerce plugin) product reviews can be written on Discourse. Does anyone have any ideas on what needs to be done to return the rating and average_rating fields with the information returned from wordpress.json?

I’ve got it working by returning the topic custom fields through the TopicViewWordpressSerializer and the post custom fields through the PostWordpressSerializer.

(Angus McLeod) #52

Nice. Let me know if you have any other issues.

(David) #53

Hi. I got the following fatal error after rebuilding the app. I am running v1.6.0.beta9 +16. No rating box shows up when creating new topics or posts. Thanks

NoMethodError (undefined method custom_fields' for nil:NilClass) /var/www/discourse/plugins/discourse-ratings/plugin.rb:55:incalculate_topic_average’

Beginner's Guide to Creating Discourse Plugins - Part 1
(Angus McLeod) #54

@doserved I just made a slight change, could you test it again? If it fails again please post as much of the log here as possible.


(David) #55


It works now. Thanks for making the fix!


Beginner's Guide to Creating Discourse Plugins - Part 1
(Daniela) #56

Italian translation (469 Bytes)

(Angus McLeod) #57

Cool, if you make it a PR I’ll add it to the repo.

(王硕) #58


Thanks for your efforts.

I have tried to install stable version and master version on the newest discourse version, it cannot work for me. Can this plugin compatible with the discourse master version which has already tag plugin embeded. 

Looking forward to your reply.

(Angus McLeod) #59

Hey, are you seeing any errors in the console? or in /logs ?

(王硕) #60

I just download the code from github into directory discourse/plugins/.

I use the develoment environment.