Closed ghost closed 7 years ago
I will probably do something like:
if( $is_real <= 0 ) {
printf(__('Invalid Answer to Poll ID #%s', 'wp-polls'), $poll_id);
die();
}
if( $poll_id <= 0 || empty($poll_aid_array) || ! check_allowtovote()) {
printf(__('Invalid Poll ID. Poll ID #%s', 'wp-polls'), $poll_id);
die();
}
if ( $is_poll_open <= 0 ) {
printf( __( 'Poll ID #%s is closed', 'wp-polls' ), $poll_id );
die();
}
if ($check_voted > 0) {
printf(__('You Had Already Voted For This Poll. Poll ID #%s', 'wp-polls'), $poll_id);
die();
}
// Rate The Poll
I added a switch statement to handle the errors. I also moved some variables around to make it run cleaner. This was tested on my own local instance of WordPress, and it worked without any problems. If this isn't what you were looking for, it's cool.