Sunday 19 May 2013

Up/Down voting system for Wordpress

Up/Down voting system for Wordpress

Looking in all posts with keywords "voting system, upvote, downvote", I can't find a satisfying solution for this issue, except accepting one of the available plugins, spend a lot of time undersanding it and try to modify its functionnalies so that they fit with the requirements. So, I am convinced in writing my own code to create a stack-exchange-like voting system for Wordpress. Without your suggestions I cannot find the starting point for the main part of the skeleton of my code.
My actual approach :
Create two custom fields: the first stores the number of post upvotes, and the second, the number of downvotes. It is possible to display votes state using get_post_meta function, and change vote state from front end using update_post_meta.
Find a way to store in the database the voted posts by a specific user and the state of vote(up, down or nothing). So that logged in users see if they already voted.
If (user is logged in )
{
Show the upvote or downvote state already done by this user;
Allow voting ;
}
else
{
don't allow voting;
}
My question is: How to resolve the second issue. Is there a way to achieve it using the customizing features offered by Wordpress PHP functions (without using SQL queries, since I don't know how to use SQL). I observe that all the Up/Down voting plugins use SQL queries in their code which make me really scared. Should I learn SQL to achieve my goal?
I thank you very much for your usual help.

No comments:

Post a Comment