WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Share session for multiple wp installs (3 posts)

  1. Haller
    Member
    Posted 6 years ago #

    Lo everyone,

    I've successfully installed 2 separate wp install which share their users and user_meta tables. I've done this by making changes which can be found here:
    http://trac.wordpress.org/ticket/3444
    http://trac.wordpress.org/attachment/tick...
    An extra note to these changes: Go to both (depending on the number of wp installs running, in my case 2) option tables and find the option with option_name [your_prefix]_user_roles and rename this to user_roles. If you don't do this no user will be able to log in.

    Now my question. Is it possible to share the session so that an user doesn't have to login again when switching from one install to the other?

    Thanks.
    Haller

  2. Haller
    Member
    Posted 6 years ago #

    First of all its not sharing a session but sharing a cookie...

    Like I said before I have 2 seperate WP installation running which are sharing the tables users and user_meta.
    They are located in /myfolder/nl/ and /myfolder/en/.

    SOLUTION:

    Insert the following code in your wp-config.php file just before require_once(ABSPATH.'wp-settings.php');

    define('COOKIEPATH', '/myfolder/'); //set this to the folder where all WP installs are located
    define('SITECOOKIEPATH', '/myfolder/'); //set this to the same folder as COOKIEPATH, otherwise multiple cookies will be set with different paths
    $cookiehash = md5("http://www.yourdomain.com/myfolder"); //create cookie hash, if not done WP will not read the cookie set on the other WP install
    define('COOKIEHASH', $cookiehash); //define the hash

    Now if I log in at http://www.mydomain.com/myfolder/nl/wp-login.php and switch to http://www.mydomain.com/myfolder/en/wp-admin im loggedin!

    Thats all Folks... ( Funny how I can say that after 10 cups of coffee and no hair on my head :P )

  3. voxmatt
    Member
    Posted 5 years ago #

    I can't seem to get this to work on 2.6. I'm trying to use the cookie across a root install and a subfolder install, for example:
    http://root.com/
    http://root.com/wordpress/

    Assuming that the above fix works for this situation, do I change the code in config.php for both installs? What could I be doing wrong here?

    Any help would be much appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic