Plugin Author
YOP
(@yourownprogrammer)
Hi wolfang8,
Edit your poll and in Answers Advanced Options set “Add the values submitted in “Other” as answers:” to No and save.
Let us know if you need more help.
Best wishes,
YOP Team
Thanks for reply. I have a question. I applied what you mentioned and other answer did not work anymore. Then it means “Other Anwer Option” is useless (I am sorry, but it’s not offensive. I am just confused). Correct? Or do you have plan to fix it in next update?
Plugin Author
YOP
(@yourownprogrammer)
Hey wolfang8,
Sorry, we thing we misunderstood your request. If you want to prevent duplicate answers in “Other” from being added to the list please make these changes: edit yop_poll_model and in register_vote function, specifically in
if ( '' != strip_tags( trim( $request['yop_poll_other_answer'] ) ) ){
add
$ans = self::yop_poll_get_answer_from_db($poll_id);
foreach($ans as $a){
if(strtoupper (strip_tags( $request['yop_poll_other_answer'] ))==strtoupper( $a['answer'])) {
$this->error = __( 'the error message you want!', 'yop_poll' );
return false;
}
Next, in the same file, yop_poll_model add
public function yop_poll_get_answer_from_db($id) {
global $wpdb;
$answer = $wpdb->get_results( $wpdb->prepare( "
SELECT *
FROM " . $wpdb->yop_poll_answers . "
WHERE poll_id = %d
",$id ), ARRAY_A );
return $answer;
}
Regards,
YOP Team
Should the codes go in the plugin edit option? Sorry, I am a beginner of codes.
Plugin Author
YOP
(@yourownprogrammer)
Hey wolfang8,
From your WordPress menu, go to Installed Plugins, locate YOP Poll plugin and click on Edit.
Once you do that, on the right hand side you will see a list of Plugin Files. Find yop-poll/inc/yop_poll_model.php and click on it then follow the instructions we provided in our previous reply.
If you still have difficulties please email us at yop.help{at]gmail.com with your wp login and we will make the necessary changes.
Best wishes,
YOP Team
Hi, I will try it later and will let you know the result. Thanks a lot for your support.