Jump to content

RoberJames

New Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About RoberJames

  • Rank
    Newbie
  1. Update! Sorry, i have found a updated version of this. Here: http://bavotasan.com/2011/a-better-voting-system-for-wordpress/ The functions file looks like this: add_action("wp_ajax_add_votes_options", "add_votes_options"); add_action("wp_ajax_nopriv_add_votes_options", "add_votes_options"); function add_votes_options() { if (!wp_verify_nonce($_POST['nonce'], 'voting_nonce')) return; $postid = $_POST['postid']; $ip = $_POST['ip']; $voter_ips = get_post_meta($postid, "voter_ips", true); if(!empty($voter_ips) && in_array($ip, $voter_ips)) { echo "null"; die(0); } else { $voter_ips[] = $ip; update_post_meta($postid, "voter_ips", $voter_ips); } $current_votes = get_post_meta($postid, "votes", true); $new_votes = intval($current_votes) + 1; update_post_meta($postid, "votes", $new_votes); $return = $new_votes>1 ? $new_votes." votes" : $new_votes." vote"; echo $return; die(0); } Perhaps i just need a bit of code to refresh the $votes count?
  2. Good day, I have a limited understanding of php. I have been working on creating a community using buddypress/wordpress for 6 months now. I have overcome very many obstacles. However there is one obstacle i have been stuck on for months now. My community would be similar to a link submission site. I want links posted to be voted on daily, i want the links ordered from most voted to least voted. I want the vote count to refresh every 24 hours. I found a solution here: http://bavotasan.com/2009/simple-voting-for-wordpress-with-php-and-jquery/ This solution works, but it does not refresh every 24 hours. As far as i can tell, all i need to do is add a simple code to vote.php or functions.php? Any ideas?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.