Can't login to the admin area on multisite sites with Domain Mapping plugin

I have a subfolder multisite setup (WordPress 4.1) with the Domain Mapping plugin installed (4.2.0.6) and the following options set:

- Admin Mapping - Original Domain
- Login Mapping - Mapped Domain

When I visit the login page for the core site (coresite.com/wp-admin/, for example) I get redirected to coresite.com/subsitefolder/wp-login.php. I enter the super admin's username and password, get logged in and then taken to the dashboard for that site. Fine, all works.

However, when I visit the login page for one of our sub sites (subsite.com/wp-admin/, for example) I get redirected to subsite.com/wp-login.php. I enter the super admin's username and password but this time I get "ERROR: Incorrect username or password.".

I can't seem to allow the user to login using the mapped domain no matter what I do. I have set both options back to "Original Domain" for now and that works fine.

It's just really annoying because I can't use preview for posts/pages, and the admin bar doesn't appear on the front-end because WordPress doesn't see the user as logged in because of the different domain.

Any help would be much appreciated.

Thanks,
Jams

  • Michael Bissett

    Hey @landauforte, hope you're doing well today! :slight_smile:

    It sounds like there's a cookie issue taking place here, but I'd like to have a closer look at the situation. Could you please send in the following:

    - Mark to my attention, the subject line should contain only: ATTN: Michael Bissett
    - Do not include anything else in the subject line, doing so may delay our response due to how email filtering works.
    - Link back to this thread
    - Include WordPress network admin access details (login address, username & password)
    - Include WordPress subsite admin access details (login address, username & password)
    - Include FTP log-in details (hostname, username & password)
    - Include any relevant URLs for your site

    On the contact form, select "I have a different question", this ensures it comes through and gets assigned to me.

    https://premium.wpmudev.org/contact/

    Thanks a bunch! :slight_smile:

    Kind Regards,
    Michael

  • Michael Bissett

    Hey @landauforte,

    No worries, thanks for sending that in! :slight_smile:

    After having a peek inside your Multisite, I can see the behavior that you mentioned here in the ticket, but was unable to investigate further via FTP, as it kept timing out for me (I had a colleague test this as well, and it kept timing out for him too).

    I'm sending you an email requesting cPanel access details, so I can look at this that way, instead of FTP. If you could send those along, that'd be great! :slight_smile:

    Kind Regards,
    Michael

  • Michael Bissett

    Hey @landauforte! :slight_smile:

    After getting in to your site via FTP (thanks for the help on your end with that), I noticed that the wp-config.php was configured... rather curiously.

    In particular, these lines were commented out:

    define('DOMAIN_CURRENT_SITE', 'www.lfct.org.uk');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);

    And these two were showing up after the "That's all, stop editing!" line:

    error_reporting(0);
    @ini_set(‘display_errors’, 0);

    The big thing though was having this defined:

    define('COOKIE_DOMAIN', 'www.lfct.org.uk'); // Added by W3 Total Cache

    After rearranging things inside your wp-config.php & removing that COOKIE_DOMAIN define, the other thing I had to do was to enable "Cross-domain autologin" inside the Network Dashboard, by going to:

    Settings -> Domain Mapping

    And now, I'm seeing that I'm able to log in without issues on your subsites, with the following options set inside of Domain Mapping:

    - Admin Mapping - Original Domain
    - Login Mapping - Mapped Domain

    Could you confirm on your end that this is working as it should please?

    Kind Regards,
    Michael

  • landauforte

    You, sir, are an absolute genius!

    Thank you so much. The login redirection and mapping now works perfectly. This has now allowed me to open up post previews to our staff along with fixing several other issues.

    I took a look in the wp-config.php a while back and noticed a few oddities. I think some of it stemmed from a bad installation of W3TC and the fact the file is from an old version of WordPress. Perhaps this caused some formatting/placement issues within the config? Anyways, not to worry. It's all working now and I can't thank you enough.

    Cheers,
    James

  • Chris

    This also helped me out a lot! One more thing would be to some how show the admin bar when viewing the actual site or is this not possible? Im logged into my main site. I go to the multisite site thats domain mapped, Im instantly able to see the sites dashboard at the subdomain address but when I go to view the site it treats it like I am logged out. Is there a way to fix this or no?

    Thanks so much.

  • Michael Bissett

    Hey @Chris,

    It sounds like "Cross-domain autologin" needs to be set to "Yes" inside your Network Dashboard, via:

    Settings -> Domain Mapping

    I'd also advise setting "Load Cross-domain autologin asynchronously", that can help with the page speed.

    As this is a pretty old thread though (not to mention one that's on a different topic), we'll want to take things to a different thread, you can open a new one over here:

    https://premium.wpmudev.org/forums/#question

    Hope this helps! :slight_smile:

    Kind Regards,
    Michael

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.