Plugin Author
YOP
(@yourownprogrammer)
Hi John,
Please edit inc/yop_poll_model.php and on line 3699 replace these 2 blocks
if( $multiple_answers ) {}
else {}
with
if ( $multiple_answers ) {
if ( isset( $answer_options['is_default_answer'] ) && 'yes' == $answer_options['is_default_answer'] )
$temp_string = str_ireplace( '%POLL-ANSWER-CHECK-INPUT%', '<input type="checkbox" checked="checked" value="'.$answer['id'].'" name="yop_poll_answer['.$answer['id'].']" id="yop-poll-answer-'.$answer['id'].'" />', $m[5] );
else
$temp_string = str_ireplace( '%POLL-ANSWER-CHECK-INPUT%', '<input type="checkbox" value="'.$answer['id'].'" name="yop_poll_answer['.$answer['id'].']" id="yop-poll-answer-'.$answer['id'].'" />', $m[5] );
}
else {
if ( isset( $answer_options['is_default_answer'] ) && 'yes' == $answer_options['is_default_answer'] )
$temp_string = str_ireplace( '%POLL-ANSWER-CHECK-INPUT%', '<input type="radio" onclick="if( jQuery(this).is(\':checked\') ) jQuery(this).closest(\'form\').find(\'button[class=yop_poll_vote_button]\').click()" checked="checked" value="'.$answer['id'].'" name="yop_poll_answer" id="yop-poll-answer-'.$answer['id'].'" />', $m[5] );
else
$temp_string = str_ireplace( '%POLL-ANSWER-CHECK-INPUT%', '<input type="radio" onclick="if( jQuery(this).is(\':checked\') ) jQuery(this).closest(\'form\').find(\'button[class=yop_poll_vote_button]\').click()" value="'.$answer['id'].'" name="yop_poll_answer" id="yop-poll-answer-'.$answer['id'].'" />', $m[5] );
}
Please note that once you save the changes they will apply on all your polls.
Also, if in “Options” you set “Vote as WordPress User” and “Vote as Anonymous User” to “Yes”, then the vote will not be registered unless
the users click on the corresponding buttons.
Best wishes,
YOP Team
Thanks! Works like a charm! You guys are the best!
An additional note – I tried deleting the “vote” button from the template, but nothing happens when you select an answer in the poll. So I put it back in, but used CSS to hide it (display:none).
Okay- I may need to hire you on this one. Your javascript code above works fine when using the shortcode in a regular post, but now I’m trying to put it on a page where shortcodes don’t normally work. I inserted this into the template file:
<?php echo do_shortcode(‘[yop_poll id=”1″]’); ?>
Now the poll shows up, but nothing happens when I select an answer. I then made sure the javascript was called in the head by copying and pasting it from a page where it was working, but still no luck.
Any suggestions?
Plugin Author
YOP
(@yourownprogrammer)
Hey John,
Please add the JavaScript code in the footer and try again.
Regards,
YOP Team
Thanks, but still no luck. Can you tell me what the javascript code should be or at least the names of the files?
Plugin Author
YOP
(@yourownprogrammer)
Hi John,
Please send us a link to the page where you have the poll.
Best wishes,
YOP Team
Plugin Author
YOP
(@yourownprogrammer)
Hey John,
In the file you inserted <?php echo do_shortcode(‘[yop_poll id=”1″]’); ?>
try to replace this line with <?php return_yop_poll(1); ?>
Regards,
YOP Team
I tried your php code above – no luck, although it may work if I played around more with the javascript.
I did, however, find a solution – iframe! Check it out here:
http://bullbord.com/apps/contest/best-kent-restaurant/
still a work in progress…