Ajax and Domain Mapping don't play well together.

There seems to be fundamental bug or issue with Domain Mapping and ajax.

I came across it when I was setting up a Q&A site using the Q&A plugin. Everything was working fine, but when I added a unique domain name to it, all the ajax started throwing call undefined errors.

Here the thread where I talked about and another member offered a solution: This is probably an ajax issue that is currently part of using mu and domains. It has to do with loading ajax-admin.php - it can't find it. The fix I found was to disable remote login, and allow the dashboard for that website to use the mapped domain instead of the original subdomain. Check your error console when you try to activate the ajax object and you should see something about call undefined. This is something I experience when trying to setup a Q&A site with the Q&A plugin. This is not plugin specific, but an Ajax/domain mapping issue.

I'm not sure what the fix is, it could either be in WP core or perhaps the Domain Mapping plugin (I'm currently using the one from the repository, not WPMU DEV's)

When you change the settings, you will lose login pass through when the site is navigated to from the main site or other sites on the network, but you will gain ajax function.

This is something that should be looked into and considered a significant bug, because the whole point of a MarketPlace network is to enable seamless shopping across websites without having to constantly login.

Reference: http://premium.wpmudev.org/forums/topic/voting-not-working-getting-ajax-related-error

This came to mind again this morning when I spotted another thread featuring the same type of issue, but this time with the MarketPress plugin: http://premium.wpmudev.org/forums/topic/domain-mapping-and-marketpress-compatibility-in-31-on-subdomain-install

Whenever a unique domain us mapped to a subdomain install, the ajax fails because it cannot find admin-ajax.php because it is looking for it here: subdomain.mydomain.com/wp-admin/admin-ajax.php but it returns a GET undefined error. The only way to get ajax to work is to set allow the dashboard for that particular site to use the mapped domain instead of the original domain, which creates a problem. It also forces a disabling of remote login. Without remote login, login pass-throughs don't happen as users browse the network, they then have to login again to use the site when they get to it.

Now, I am reporting this as the behavior of the domain mapping plugin from the plugin repository (http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/). I admit haven't switched over to WPMU DEV's domain mapping plugin yet because of the labor involved and the inconvenience that it brings to my users. I do not know how WPMU DEV's domain mapping plugin behaves in this regard and I'm hoping that someone will fill me in - if I am going to make the switch and attempt to get everyone on board with it, then I need to know all the facts before I do.

    Mason

    Hiya Saunt Valerian,

    Thanks for the detailed explanation of what's going on here. I've alerted a couple of our developers to come in and take a look. They're respond with some options here and we are actively working on the domain mapping plugin with some improvements as well.

    Just as a note, our domain mapping plugin should be compatible with the one on wp.org I don't believe there's anything special that has to be done to transition from one to the other - although I admittedly haven't tested this in awhile. Can anyone confirm?

    Thanks!

    Aaron

    We recommend setting domain mapping to whatever the user enters. I think our domain mapping plugin actually forces this option for just admin Ajax. If not yet it's slated for the next release.

    raison-online
    • Elite
    • 121
    • #906

    I'm having problems with Domain mapping and Ajax with the Front End Editor plugin... someone also had similar problem here: http://wordpress.org/support/topic/ajax-in-subsite?replies=5

    The solution for them was:

    In the domain mapping configuration do NOT select: "Redirect administration pages to site's original domain (remote login disabled if redirect disabled)".

    Now my ajax content is working on the virtual domain!

    any idea how this is done for the WPMU Domain remapper?

    thanks

    raison-online
    • Elite
    • 121
    • #906

    3.0.5 dev version of which? The dev version of DM should be 0.5.4.2.

    For DM, all you need to do is replace domain_mapping.php and sunrise.php. There are only bug fixes in the dev version so you won't see any difference between it and the last released version.

    I did put in a couple changes for WP 3.3 compatibility but those changes will work with any version after 3.0.

    From: http://wordpress.org/support/topic/plugin-wordpress-mu-domain-mapping-wp-mu-domain-mapping-problem-with-ajax-request-from-the-all-in_one-event-caledar?replies=5

    Is this sensible?

    raison-online
    • Elite
    • 121
    • #906

    Ok - Found this... Looks very complicated though:

    Ajax is going to return an empty response in WP3.x.x MultiSite (with domain mapping) because, by design (in FF), ajax does not allow calls to a different domain (if not in jsonp as it's the case).

    Th issue is that WP inits all the scripts with the siteurl domain (e.g. sub.mysite.com), but when the admin is invoked within a mapped site (www.mymappedsite.com) the ajax call needs to happen within that mapped domain too.

    http://wordpress.org/support/topic/empty-ajax-response-multisite-fix?replies=3

    aecnu

    Greetings noriise,

    Thank you for being a WPMU Dev member!

    any idea how this is done for the WPMU Domain remapper?

    Logged in to the network dashboard go to Setting --> Domain Mapping --> category Administration mapping and you will find the choices as outlined in the graphic below.

    Our lead developer Aaron said "We recommend setting domain mapping to whatever the user enters. I think our domain mapping plugin actually forces this option for just admin Ajax. If not yet it's slated for the next release."

    This is what mine is set for and I have not had any issues.

    Saunt Valerian said "The only way to get ajax to work is to set allow the dashboard for that particular site to use the mapped domain instead of the original domain, which creates a problem." but from what I can tell he does not mention what that problem may be.

    Therefore the setting NOT to choose is use original domain which is circled in red below.

    Cheers, Joe :-)

    Due to the fact that the lead developer has been made aware of the issue, acknowledged it has been slated to be addressed, and though not ideal temporary work a-rounds have been addressed, there is no longer any reason to keep this ticket open for further discussion but definitely a useful reference.

    raison-online
    • Elite
    • 121
    • #906

    I just ended up using the Domain Remapper that is in the wordpress repository and not the WPMU one.

Join 375025 happy members

Get access to our entire collection of epic plugins, astonishing themes & genius support

Become a member