Forums

[resolved] Single Login across Multiple Wordpress Installations (4 posts)

  1. alkafy
    Member
    Posted 1 month ago #

    Howdy!

    Previous threads have helped me share users between two Wordpress installs, but I ran into a problem: When a user logs into one, they're not logged into the other (and vice versa.) I'd really like to transfer the session between the two and only require users to log in once.

    Here's what I did to share users, if it's helpful. "Secondary" refers to the Wordpress Installation residing within a subdirectory of the "Primary" Wordpress Installation:

    Added

    define(‘CUSTOM_USER_TABLE’, ‘wp_users’);
    define(‘CUSTOM_USER_META_TABLE’, ‘wp_usermeta’);

    to wp-config.php in Secondary Wordpress root.
    ——————————
    Changed

    $this->cap_key = $wpdb->prefix . ‘capabilities’;

    to

    $this->cap_key = ‘wp_capabilities’;

    in capabilities.php in wp-includes of Secondary Wordpress install

    Thank you for all your help!

  2. jeremyclark13
    Moderator
    Posted 1 month ago #

  3. Otto42
    Moderator
    Posted 1 month ago #

    I'd really like to transfer the session between the two

    WordPress does not use sessions, and if the URL's of the two sites are on different domains, then the cookies cannot be passed from one to the other (browser security restrictions). Therefore what you want is not possible in such a case.

    In multiple folders on the same domain, it can be done, as shown by the link given above.

  4. alkafy
    Member
    Posted 1 month ago #

    I'm sorry, I wasn't sure which method Wordpress used.

    In any case, the recommended solution worked without a hitch and I'm very impressed with its simplicity. Thank you, thank you.

Reply

You must log in to post.

About this Topic