1. Not sure if that has anything to do with the plugin
2/3. You can set the cookie to expire after 24 hours so they can vote again.
How would I set the Cookies to expire in 24 hours?
I don’t see this option in the pugin control panel
Would something like this work:
add_action( 'init', 'my_setcookie' );
function my_setcookie() {
setcookie( 'my-name', 'my-value', time() + 86400, COOKIEPATH, COOKIE_DOMAIN );
}
You have to modify the plugin code https://github.com/lesterchan/wp-postratings/blob/master/wp-postratings.php#L627 to do it. It is not in the control panel since the plugin is designed to be rated once only.
Lester …
Thanks so much!
I modified `// Only Create Cookie If User Choose Logging Method 1 Or 3
$postratings_logging_method = intval(get_option(‘postratings_logging_method’));
if($postratings_logging_method == 1 || $postratings_logging_method == 3) {
$rate_cookie = setcookie(“rated_”.$post_id, $ratings_value[$rate-1], time() + 30000000, apply_filters(‘wp_postratings_cookiepath’, SITECOOKIEPATH));
}`
To look like this
// Only Create Cookie If User Choose Logging Method 1 Or 3
$postratings_logging_method = intval(get_option('postratings_logging_method'));
if($postratings_logging_method == 1 || $postratings_logging_method == 3) {
$rate_cookie = setcookie("rated_".$post_id, $ratings_value[$rate-1], time() + 86400, apply_filters('wp_postratings_cookiepath', SITECOOKIEPATH));
}
Fingers crossed 🙂
Yea just ensure you choose logged by Cookie in the Ratings Options =)
Yup, did just that!
Thanks for the assist!! Greatly appreciated!
Another quick question …
If I were to remove the .$post_id from the string would that limit the user to only ONE vote TOTAL per day, meaning they wouldn’t be able to vote on any other posts at all that day?
Which is what I really want to happen 🙂
Still having an issue – SORRY!!
Settings:
Who Is Allowed To Rate? Guests Only
Ratings Logging Method: Logged by Cookies
The code in wp-postratings.php is set to
// Only Create Cookie If User Choose Logging Method 1 Or 3
$postratings_logging_method = intval(get_option('postratings_logging_method'));
if($postratings_logging_method == 1 || $postratings_logging_method == 3) {
$rate_cookie = setcookie("rated_", $ratings_value[$rate-1], time() + 86400, apply_filters('wp_postratings_cookiepath', SITECOOKIEPATH));
}
And I’m still able to go to other posts that have the ratings shortcode in them and vote 🙁 Am I overlooking something?
SWEET!
Great Catch!! That seems to be working! 🙂