• Resolved wolfang8

    (@wolfang8)


    Hi, thanks for great plugin. I have run into an issue. I allowed “Other” answers. When someone input same words in other field, it creates another new one.
    For example.

    ===============================
    Who is the best fighter?

    1. Ryu
    2. Ken
    3. Guile
    4. Chun Li
    5. Blanka
    Other
    ===============================

    If someone input Ryu in other field then another Ryu is created even though it is exactly same letters. Plus, the new one which is created with this way does not show on the list in option page. So I even can not remove it. Are there any solutions?

    https://www.ads-software.com/plugins/yop-poll/

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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

    Thread Starter wolfang8

    (@wolfang8)

    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

    Thread Starter wolfang8

    (@wolfang8)

    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

    Thread Starter wolfang8

    (@wolfang8)

    Hi, I will try it later and will let you know the result. Thanks a lot for your support.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Other option issue’ is closed to new replies.