WordPress.org

Ready to get started?Download WordPress

Forums

YOP Poll
Bad Request (7 posts)

  1. Bmadley
    Member
    Posted 2 months ago #

    Hi,

    First off, love the plugin. It's great. One thing I noticed recently was that sometimes when someone fills out a poll they get a "Bad Request" message at the top and I was wondering if you had any thoughts on what might cause that. It seemed to be happening in Google Chrome but not in Safari when I checked. I recently installed W3 Total Cache and wondered if that might be causing the hiccup and when I cleared the cache the polls did seem to work again so perhaps that's it. Do you know if caching plugins can occasionally conflict with the polls?

    Also, if I wanted to change the "Bad Request" message that appears at the top of the poll when that happens, is there a place in the code that I could make that alteration?

    Thanks for all your help and this great plugin!

    Brad

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

  2. fratony
    Member
    Posted 2 months ago #

    I am getting the same problem but it is an apparently random - but quite frequent - issue for my users that is starting to annoy them.

    I use WP Super Cache, but again, most users are able to vote ok but on occasions they get the 'bad request' error.

    To be clear, individual users sometimes can vote and sometimes cannot, rather than some always being ok and others always having problems.

    Any thoughts?

  3. fratony
    Member
    Posted 2 months ago #

  4. YOP
    Member
    Plugin Author

    Posted 2 months ago #

    Hi,

    From what we know, W3 Total Cache generates static pages for your posts/website pages and then sends them to the browser.

    Our plugin uses a nonce-field generated each time the poll is being displayed.

    When W3 Total Cache sends static pages it also send the poll and all its fields, including the nonce-field that remains unchanged and this generates the bad request error.

    There is nothing we can do on our end as removing the nonce-field verification would lead to security issues with the votes count.

    You can replace the "bad request" message with a custom message if you follow the instructions below:

    edit inc/yop_poll_model.php and in the register_vote function, approximately on line 2799, replace the Bad Request! message in
    $this->error = __( 'Bad Request!', 'yop_poll' ); with the message you want so in the end you should have
    $this->error = __( 'desired_message', 'yop_poll' );

    Nest wishes,

    YOP Team

  5. fratony
    Member
    Posted 2 months ago #

    Thanks for the reply. Just so I can understand (I'm afraid I am not a techie), does this mean the YOP poll does not work with WP Super Cache?

    The odd thing is that it clearly does work most of the time as I have been running a daily poll for several months and get lots of votes every day.

    However, it seems that for a proportion of voters they either get a 'bad request' message or, for some, the poll just does not take their vote.

    Although I am still trying to clarify, it appears those having problems are on mobile devices and possibly using the WPTouch mobile version of the site. Again, others on mobile platforms have been able to vote and those having problems have previously been able to vote.

    The really puzzling thing is that WP Super Cache is specifically set to allow WP Touch so I would not have expected the problem from people viewing this way.

    Anyone successfully using YOP with WPTouch running for mobile devices?
    Anyone doing the same with WP SuperCache too?

    Thanks!

  6. fratony
    Member
    Posted 2 months ago #

    Update:

    I have been able to repeat the issue myself using a mobile device and the mobile platform served up by WP Touch.

    Basically it is not giving the "Bad response" error but it just doesn't work - when you click to vote it just refreshes the page but no vote is registered. Same if you click "View results" - it just reloads and doesn't show the results.

    I have turned WP SUper Cache off and the problem is not changed so this particular aspect does not seem to be related to that but instead seems to be, if anything, a WPTouch issue.

    However, as I have said previously, it has not been as issue previously.

  7. YOP
    Member
    Plugin Author

    Posted 2 months ago #

    Hi fratony,

    Edit js/yop-poll-public.js and in yop_poll_show_loading function comment this line

    target_loading_image.alt = yop_poll_public_config.loading_image_alt;

    Regards,

    YOP Team

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.