P1x44r
New member
Created this the other day. This does not use any fancy AJAX framework, but is a simple way to allow article rating via AJAX. It is IP-based to prevent multiple votes on the same item.
My way of contributing back to the community.
Right now I don't have the time to post explanation, but it should be easy enough for anyone to pick up and expand upon. The code might be a little messy, but I ripped this right out of my website and had to replace a bunch of wrappers with native calls(mostly for DB).
The only thing that might need a little explaining is my call in index.php
Number one(1) in both, first and second function calls is your article id that you want to enable voting on as pulled from the database.
If you got any questions, feel free to ask here, I'd be more than happy to help.
Get it here: http://www.p1x44r.com/files/
Demo is also available on my website. Just go to the front page and look right under each article preview section. You will see it current rating and will be able to cast your vote.
Enjoy!
My way of contributing back to the community.
Right now I don't have the time to post explanation, but it should be easy enough for anyone to pick up and expand upon. The code might be a little messy, but I ripped this right out of my website and had to replace a bunch of wrappers with native calls(mostly for DB).
The only thing that might need a little explaining is my call in index.php
Code:
print get_article_rating(1, user_voted(1));
Number one(1) in both, first and second function calls is your article id that you want to enable voting on as pulled from the database.
If you got any questions, feel free to ask here, I'd be more than happy to help.
Get it here: http://www.p1x44r.com/files/
Demo is also available on my website. Just go to the front page and look right under each article preview section. You will see it current rating and will be able to cast your vote.
Enjoy!
Last edited: