Two different installs: Login once (share cookies) (2 posts)

  1. kalledrengennr1
    Posted 10 months ago #

    Hi folks,

    I knooooow many before me have had, asked about and gotten answers to this issue ..but some are for older versions of WP, and I JUST can't get this to work :-(

    Situation: I have two *different installs (WP1 and WP2)of WP on the same domain running on the same database using different prefixes.
    *different = WP2 is a backupbuddy backup of WP1.

    Need: To be able to login ONCE on eiter WP1 or WP2 and to then be logged into both.

    Problem: I have tried "everything", but I just can't get it to work! Salts are the same in wp-config.php for WP1 and WP2.

    This is the wp-config.php of WP2. Values are changed to dummy values:

     * 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 http://codex.wordpress.org/Editing_wp-config.php 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('DB_NAME', 'wp_db');
    /** MySQL database username */
    define('DB_USER', 'wp_user');
    /** MySQL database password */
    define('DB_PASSWORD', 'password');
    /** MySQL hostname */
    define('DB_HOST', 'something.unoeuro.com:');
    /** 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 https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org 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',         'salt1');
    define('SECURE_AUTH_KEY',  'salt2');
    define('LOGGED_IN_KEY',    'salt3');
    define('NONCE_KEY',        'salt4');
    define('AUTH_SALT',        'salt5');
    define('SECURE_AUTH_SALT', 'salt6');
    define('LOGGED_IN_SALT',   'salt7');
    define('NONCE_SALT',       'salt8');
     * 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  = 'wp1_';
     * 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
     * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
     * language support.
    define ('WPLANG', 'da_DK');
     * 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);
    $root_host = 'mysite.com';
    define( 'COOKIE_DOMAIN', '.'.$root_host );
    define( 'COOKIEHASH', md5('http://'.$root_host) );
    /* That's all, stop editing! Happy blogging. */
    /** Absolute path to the WordPress directory. */
    if ( !defined('ABSPATH') )
    	define('ABSPATH', dirname(__FILE__) . '/');
    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . 'wp-settings.php');

    I've alto tried:

    $cookiehash = md5("http://uniqture.dk");  // Use Site A's URL
    define(CUSTOM_USER_TABLE,'uniqture_users');           //Change 'wp' to match the prefix set during
    define(CUSTOM_USER_META_TABLE,'uniqture_usermeta');   //  Site A's installation
    define('COOKIEPATH', '/');                      //This path should reference Site A's root
    define('SITECOOKIEPATH', '/');                  //Should match 'COOKIEPATH'
    define('COOKIEHASH', $cookiehash );

    Can anyone help me getting this t work? It's probably simple as heck ..but I just can't get this important "little" thing to do as I want it to :-(

    (..and no, a multisite is not a solution for me, as I need an exact copy of my main site, whis will take me forever to recreate + need 100% control when editing both sites)

    Thanks a lot in advance for any help! :-)

    [ No bumping please. ]

  2. Luisma MedicalESP
    Posted 3 months ago #


    I got the exact same problem here, and I've been searching all along solutions but nothing I find on the web seems to work for me, may be because is done for older versions of WP as kalledrengennr1 says.

    Can anyone help me?

    Thanks so much!


You must log in to post.

About this Topic