• Resolved elundin

    (@elundin)


    Hi there!

    I have been looking for this kind of poll plugin for quite a while. There are a lot of bad ones out there but this one seems to have it all. Great work!

    There is only one little piece I’m looking for. I really like that ther is finally a plugin that let you use the option to add an “Other” field to the poll.

    What if you could make those entries votable aswell? That if you add a custom answer it not only show up in the result but also as a new option when you vote the next time.

    I saw that there have been som questions about this in earlier threads and I’m just interested in if you ate considering that kind of functionallity for upcoming releases and if you do – do you have a date for the next release?

    Thanks again for a great plugin! I will rate it now 🙂

    Cheers

    //Emil

    http://wordpress.org/plugins/yop-poll/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey,

    I was searching for the same thing and had to change the inc/yop_poll_model.php file to get this to work the way I wanted.

    Make this edit around line 2805, and again around 2850

    /*** add the "other" entry to answers - rlittle ***/
    
    // $answer['other_answer_value']  = $request['yop_poll_other_answer'];
    
    global $wpdb;
    
    $wpdb->query(
    	"
    	INSERT INTO <code>&quot;. $wpdb->yop_poll_answers . &quot;</code> (<code>poll_id</code>, <code>answer</code>, <code>type</code>, <code>votes</code>, <code>status</code>) VALUES
    	('" . $poll_id . "', '" . $request['yop_poll_other_answer'] . "', 'default', 1, 'active')
    	"
    );
    
    // if you want the "other" value to return to zero
    $wpdb->query(
    	"
    	UPDATE $wpdb->yop_poll_answers
    	SET votes = -1
    	WHERE poll_id = $poll_id
    		AND answer = 'Other'
    	"
    );
    
    /*** end edit ***/

    Make sure you comment out $answer['other_answer_value'] = $request['yop_poll_other_answer']; like I have in the above code.

    It adds the “other” entry to the answers, which you can see in the admin for the poll settings, and if you don’t want the value of “other” to return to zero, you can comment out or remove that second wpdb query.

    I’m not sure that this is 100% correct, but I checked the database and things look good, and behave perfectly, as far as I can see. There is a lot of code in this plugin, but I found that this works for a quick fix.

    actually, I just realized that the above code does something messed up because of the backticks in the SQL query, so do not use the above code. Instead, find it here: https://gist.github.com/ryplittle/6805319

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Make "Other" values available for votes’ is closed to new replies.