Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter jamesvl

    (@jamesvl)

    Resolved

    The AJAX request was failing on IE because my WP site had its admin_ssl turned on.

    A visitor on the site using http would be given the MailChimp form and the AJAX call would go to the https version of the site.

    That cross-domain request (from http or https, even on the same domain) works in FF and Chrome, but fails in IE8 and IE9. (May not be an issue in IE10.)

    The Fix

    I had to adjust the call to admin_url() in the main plugin file, based on the server’s port.

    This will let the script work on both http and https versions of the site, and falls back to the old behavior if you’re running on a non-standard port.

    if(!defined('YKSEME_URL_WP_AJAX')) {
       if ($_SERVER['SERVER_PORT'] == 80)
           define('YKSEME_URL_WP_AJAX', admin_url('admin-ajax.php', 'http'));
       else if ($_SERVER['SERVER_PORT'] == 443)
          define('YKSEME_URL_WP_AJAX', admin_url('admin-ajax.php', 'https'));
       else
          define('YKSEME_URL_WP_AJAX', admin_url('admin-ajax.php'));
    }
    Thread Starter jamesvl

    (@jamesvl)

    Correction: I see the plug-in doesn’t actually include jQuery on its own, it just has the file in its repository. My mistake.

    Haven’t delved into the code yet, but I guess you’re including and using Prototype instead of jQuery?

    jamesvl

    (@jamesvl)

    The issue is with PHP 5.4.x – I get the same error (reprinted below) when I try to install eShop on a host running PHP 5.4. I do not get the error when I install the same version (latest release) on hosts running PHP 5.3.x.

    PHP 5.4 will no longer allow us to define function variables using super-global names; e.g. I can pass $_POST to a function, but I cannot, in that function’s definition, name my parameter $_POST.

    Here’s the error message I got from WordPress:

    Plugin could not be activated because it triggered a fatal error.
    
    Fatal error: Cannot re-assign auto-global variable _POST in
    /wp-content/plugins/eshop/cart-functions.php
    on line 767

    I tried just changing that particular function definition to see if it would install, and the error popped up again from other locations in the source.

    That seems a little bit ridiculous to me. Using the ‘category’ in Permalinks works *only* with Apache 2? Where were users going to be told about this? (It wasn’t on the Codex or in the instructions page itself, last time I checked.)

    The replacement given above doesn’t work for nested categories, btw.

    If this “feature” of WP isn’t working on most web servers, it should be fixed or taken out.

    I love WP. I’m still using it. (And yes, I’m even trying to fix it.)

    I’m just disappointed such a major flaw made it into a release version.

Viewing 4 replies - 1 through 4 (of 4 total)