Jump to content

FieldtypeRate (Star Rating)


Jonathan Dart
 Share

Recommended Posts

Hi Guys,

I've decided to share my work on a Fieldtype for adding star ratings to page items. I used @apeisa's FieldtypePoll as a starting point. 

Check out the readme on github for usage: https://github.com/jdart/FieldTypeRate

I've got a couple screenshots that should demonstrate the functionality.

post-1768-0-03662700-1379726080_thumb.pn

post-1768-0-87217500-1379726112_thumb.pn

post-1768-0-73763300-1379726159_thumb.pn

Feel free to give me any feedback.

Regards,

Jonathan

  • Like 13
Link to comment
Share on other sites

This looks fantastic Jonathan.

I know that Ryan was planning on releasing something along these lines, based on the recommend button in the modules directory:

http://processwire.com/talk/topic/4206-thinking-about-a-likerecommend-button-module/?p=41222

I am curious to see what overlap there is between these two modules - hopefully they will both have their strengths and will be useful for different scenarios.

Thanks for this!

Link to comment
Share on other sites

Nice work - I like it.

Just one question though: getUaString concatenates the user agent and IP address - surely that means I can switch to other browsers and vote multiple times? Wouldn't IP be enough on its own?

Link to comment
Share on other sites

Aren't cookies the best option for this? I know you guys know this already, but surely IP address is more problematic in that it can prevent other people on the same network from voting. And even people using the same ISP may not be able to vote if they end up with an IP that is already recorded.

What about a combination of cookie and number of hits from the same IP address in a certain timeframe to prevent people from clearing their cookies and voting multiple times in a short time period. I would think this would also help to limit bot rating?

Link to comment
Share on other sites

Limiting by IP or cookie both have their drawbacks. You can imagine an office with 100 workers all behind one ip address. Cookies can also be deleted.

For my needs the implementation is good enough, but if you really wanted to prevent bots taking advantage you'd require users to be logged in to vote.

That being said the voted detection could be a lot more sophisticated.

  • Like 4
Link to comment
Share on other sites

Aren't cookies the best option for this? I know you guys know this already, but surely IP address is more problematic in that it can prevent other people on the same network from voting. And even people using the same ISP may not be able to vote if they end up with an IP that is already recorded.

I think the best option is both. At least, that's what I used in the rating module I wrote. The problem of two people on the same IP is a compromise for the reasons you mentioned, but it can be mitigated quite a bit by using the $_SERVER['HTTP_CLIENT_IP'] or $_SERVER['HTTP_X_FORWARDED_FOR'] headers instead of $_SERVER['REMOTE_ADDR'], when they are available. My opinion is that the compromises in relying on a cookie for any kind of rating are much bigger compromises than occasionally blocking a vote due to IP. 

Link to comment
Share on other sites

  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...