Support » Plugin: WordPress Popular Posts » Plugin seems to stop counting

  • Resolved mischaellstein

    (@mischaellstein)


    Hi Hector,

    everything was fine during the last weeks, but suddenly the WPP plugin stopped counting. I checked your FAQ, but the database is fine and even the “ajaxyfy” option is enabled. Do you have any idea what I coan do to solve the problem?

    Best Regards,
    Michael

Viewing 11 replies - 1 through 11 (of 11 total)
  • Oh sorry, I forgot: My website is FRAGDENSTEIN.DE

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hey Michael!

    Your site is blocking access to admin-ajax.php, preventing WPP from updating the views count.

    Did you install a security plugin or make changes to your .htaccess file(s) recently?

    Hey Hector,

    Thank you so much fo your quick reply! No, I did not change anything but I am using WP-Spamshield. I just learned from the website of this plugin that there might be compatibility issues. I will check with them and get back to you.

    Plugin Author Hector Cabrera

    (@hcabrera)

    I don’t know how WP-SpamShield works but this might help. Make sure to check with them first though.

    Hi Hector and Michael,

    I can shed some light on this. After receiving Michael’s support request and debugging info, we identified the issue.

    Right now when WordPress Popular Posts does an AJAX call, it doesn’t identify itself as an AJAX request by using the X-Requested-With: XMLHttpRequest header. That’s the de facto standard for identifying AJAX calls. You might want to check out this thread: http://stackoverflow.com/questions/1885847/jquery-no-x-requested-with-xmlhttprequest-in-ajax-request-header

    Hector:
    In the main file on line 1378 you have:

    
    xhr.setRequestHeader( "Content-type", "application/x-www-form-urlencoded" );
    

    After that, add something similar to this:

    
    xhr.setRequestHeader( "X-Requested-With", "XMLHttpRequest" );
    

    That’s all! *You’ll need to check the specifics, and test appropriately, but that’s the general gist.

    As part of WP-SpamShield’s support for all third party contact form plugins, WP-SpamShield checks the admin-ajax.php POST requests. (We can’t just check the DOING_AJAX constant in WordPress, as other non-AJAX POST requests can come in through that endpoint.)

    Currently (as of the current version 1.9.9.9.5), WPSS ignores all requests coming in through admin-ajax.php (at least for the relevant test that is currently causing the block) that are identified as AJAX with the X-Requested-With: XMLHttpRequest header. We’ll also add specific whitelisting for WPP in the next version, but if you change the params in the future, the XMLHttpRequest will help across the board (likely with other plugins as well that deal with security).

    We also have a guide for other plugin developers, and you can contact us here as well: https://www.redsandmarketing.com/plugins/wp-spamshield/hooks/

    Michael and Hector:
    There is a temporary workaround that can be used: Disable anti-spam for miscellaneous forms. However there are drawbacks, so we don’t recommend it: It will disable anti-spam for any third party forms (other than CF7 and Gravity), as well as protection against many XML-RPC based attacks, such as brute force amplification attacks and Pingback based DDoS attacks, etc. See here for more info.

    Hope this helps. Feel free to contact us for further help/info.

    — Scott

    Hi Steven, Scott and Hector,

    Thank you so far for your help. I am looking forward to the new versions of your plugins where hopefully the conflicts then will be solved.

    Best Regards,
    Michael

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hey guys,

    Scott, thank you very much for chiming in!

    Michael, since I don’t have / use WPSS at the moment I’m going to ask you to help test out Scott’s suggestion. So please:

    1. Go to Plugins > Editor and pick WordPress Popular Posts from the dropdown at the right.
    2. Add the following code right after this line:
      xhr.setRequestHeader( "X-Requested-With", "XMLHttpRequest" );
    3. Hit the Update file button to save changes.
    4. Visit one of your posts then go Settings > WordPress Popular Posts to check if WPP was able to log your visit.
    5. Report back the result here.

    Hi Hector,

    Success! The Plugin seems to get back into life again.

    Thanks a lot,
    Michael

    Hector:

    Scott, thank you very much for chiming in!

    Glad to help!

    Michael:

    Success! The Plugin seems to get back into life again.

    Very nice. 🙂

    Plugin Author Hector Cabrera

    (@hcabrera)

    Alright, I’ll include the X-Requested-With header with the next release of the plugin, so I’m marking this as resolved.

    Thank you guys for helping make WPP better!

    Outstanding. This right here is the beauty of open source. 🙂

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Plugin seems to stop counting’ is closed to new replies.