Multisite & domain mapping - logs user out between network sites


Have now set up a multi-site network and as a final stage, just activated and configured the Domain Mapping plugin

This went well and mapping is working fine, but ....

a. pre-installation - a user logged in on Site A would stay logged in when navigating to any of the other sites in the network - B, C, D etc.

b. post installation - the user is now being logged out when leaving any of the network sites to navigate to another.

Really want to the user to stay logged in across network but cannot figure where / what settings I need to adjust.

Appreciate a pointer on this one please.


  • Mike

    Hi @prize_days___paul

    Thanks for posting!

    Can you first of all confirm that you have followed all of the installation steps outlined here and here on the Usage tab.

    Particularly you need to make sure that sunrise.php is uploaded to the wp-content page and that you have added the following to the wp-config.php file:
    `define( 'SUNRISE', 'on' );

    Please let me know how you get on.


  • BizE

    Hello Mike

    Yes, I can confirm that I followed those instructions step by step, together with this article which I found useful -

    "define SUNRISE" code is in place (I renamed the MU-Multi Domain dm-sunrise.php file and moved that as instructed).

    Q - As I moved that dm-sunrise file, I also deleted the existing sunrise.php file in the Domain Mapping plugin - I assume that was the correct thing to do?

    Look forward to hearing from you again.

    Regards, Paul

  • BizE

    1. WP config file follows
    2. Yes - multi domain is installed

    * The base configurations of the WordPress.
    * This file has the following configurations: MySQL settings, Table Prefix,
    * Secret Keys, WordPress Language, and ABSPATH. You can find more information
    * by visiting {@link Editing
    * wp-config.php} Codex page. You can get the MySQL settings from your web host.
    * This file is used by the wp-config.php creation script during the
    * installation. You don't have to use the web site, you can just copy this file
    * to "wp-config.php" and fill in the values.
    * @package WordPress

    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('WP_CACHE', true); //Added by WP-Cache Manager
    define( 'WPCACHEHOME', '/home/admin/public_html/wp-content/plugins/wp-super-cache/' ); //Added by WP-Cache Manager
    define('DB_NAME', 'admin_wrdp1');

    /** MySQL database username */
    define('DB_USER', 'xxxxxxxxxxxx');

    /** MySQL database password */
    define('DB_PASSWORD', 'xxxxxxxxxxxx');

    /** MySQL hostname */
    define('DB_HOST', 'localhost');

    /** Database Charset to use in creating database tables. */
    define('DB_CHARSET', 'utf8');

    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');

    * Authentication Unique Keys and Salts.
    * Change these to different unique phrases!
    * You can generate these using the {@link secret-key service}
    * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
    * @since 2.6.0
    define('AUTH_KEY', 'W3ZCE>Akj0J|i-p4;LEzBz$ZmLN7MRE_4;NYN/ka*3^g5dp(28fRM~U0Q;MTg~^=^$D6');
    define('SECURE_AUTH_KEY', 'D(yx$<ww)=r3-@nzA1PR0p2OM:l2jjliqwd$^(C<daWVxb8!vV55R8<1LaPz');
    define('LOGGED_IN_KEY', 'nOlXhfC7=Gu:C~RO<c>oTev_=ThtVEvfsTI<7S<e9z3XptJ$i?eAEKNF-\syM<to3s\');
    define('NONCE_KEY', 'h2k?)YMvnqDS;ZSwQscRMd|I0:stuck_out_tongue:FKWbN^pgrd-oPf-XyOhX-Fc0vjnGdE-|SXNgC');
    define('AUTH_SALT', '3_Ghfs|Bma~nCuITazHc(xbJx(<c2/2PZ!wzkL<UdJlrlAPr):HJ)Ty7d9Id<i/MTW0ljsutH');
    define('SECURE_AUTH_SALT', '|Cgo-arTBbUNr?I|zD$^p\8Sd7tDn$6;AHO\7AFSV3rtw;zx6-jIVFT2-)t>v\`aA)fUcb?');
    define('LOGGED_IN_SALT', 'v4d?~H/Z2oqGdzm/Dhs7F8Xhwo>UbHf0q<p_5xfEZSg\`CRV8>tgxW_5Zp/xi234zYZMoRK*Ho');
    define('NONCE_SALT', '>f=!n5\`cbb(hxh3RZIub$C^1rOO4A:#IL(XHP8tYX;sPSzJQxpL)k*6');


    * WordPress Database Table prefix.
    * You can have multiple installations in one database if you give each a unique
    * prefix. Only numbers, letters, and underscores please!
    $table_prefix = 'wp_';

    * WordPress Localized Language, defaults to English.
    * Change this to localize WordPress. A corresponding MO file for the chosen
    * language must be installed to wp-content/languages. For example, install
    * to wp-content/languages and set WPLANG to 'de_DE' to enable German
    * language support.
    define('WPLANG', '');

    * For developers: WordPress debugging mode.
    * Change this to true to enable the display of notices during development.
    * It is strongly recommended that plugin and theme developers use WP_DEBUG
    * in their development environments.
    define('WP_DEBUG', false);
    define('SUNRISE', 'on');
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', true);
    define('DOMAIN_CURRENT_SITE', '');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);
    define('WP_MEMORY_LIMIT', '256M');

    /* That's all, stop editing! Happy blogging. */

    /** Absolute path to the WordPress directory. */
    if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');
    define( 'SUNRISE', 'on' );
    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . 'wp-settings.php');

  • Mike

    Hi @prize_days__paul

    That all looks right, why is define('SUNRISE','on'); in there twice though? Can you try removing the second.

    And is Multi-Domains set up as instructed on the usage tab here:

    Particularly step 3:

    Upload multi-domain.php and the multi-domains-files directory to the /wp-content/mu-plugins folder on your site (if you do not have this directory you will need to create it.)


  • BizE

    Hello Mike

    Not sure why the 2nd "sunrise on" was there, but have removed it and tested again. Regret to report that still getting the same result though.

    Note - there is not an issue when switching to one of the network sites which is still an un-mapped sub-domain, it just occurs on the sub-domains which have been mapped with our "vanity brand" url's.

    I confirm that the "mu-plugins" folder was already in place as per the instructions.

    Guess this is going to be a bit of a teaser, but look forward to hearing if & when you can crack it?!


  • BizE

    Hello all

    Just tried Barry's suggestion -

    1. Could not then access the primary domain site & got this message -
    "The server at "domain_current_site" can't be found, because the DNS lookup failed . . . ."

    2. Got standard public access to other mapped domain sites, but not as logged in user.

    3. So I re-loaded the 4 lines back into wp-config & still could not access primary domain site (same message). Then cleared my cache, tried again and got access back - phew!

    So regret to conclude that original issue therefore remains.


  • Barry

    Hi remove these:

    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);

    And leave the initial one (DOMAIN_CURRENT_SITE) alone - I don't get the error you are reporting on any of my installs, but I'm not running multi-domains so it may be a side effect of that.

    Once the above is done, the next step is to check your cookies - if you want to create a user for us we can do this - just let us know the site that a user would log in to, and another site that they need to then re-log into, and we can try the login - check the cookies created and try to see what is happening.