Answer the question
In order to leave comments, you need to log in
Comment rating, who put it? how to rate comments for kohana?
Hello kohana version 3.1 how to implement user comment evaluation.
Here is an example of how I would like to implement.
The main thing is that you can click once so that the IP address is taken into account.
Answer the question
In order to leave comments, you need to log in
Create a table in the database, for example comment_likes with fields id, comment_id (key to comments), ip, value (like design).
When rendering the page, you need to get all the values for each comment and calculate the score. It will probably work slowly with large volumes, you can denormalize the table with comments by adding a field with a like counter, you need to test it.
When a user likes, query this table to see if it has already been liked, like this:
But note that the IP cannot be the exact user ID.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question