I have a WordPress installation at the document root for a domain, and then an additional installation in an immediate subdirectory of that installation such that I may use different themes for the two. I want to link the two sites logins so that you don’t have to login twice in order to use both sites.
My coding skills are not great, so an easy fix or an of the shelf plugin are preferred.
You can share user tables between different WordPress installations by installing the second site (“Site B”) to use the original site’s (“Site A”) database, then choosing to use an alternate table prefix during installation so as to keep the rest of the data separate.
The second part of the problem is sharing login cookies between the two installations (what WordPress uses to keep track of login/”session” data). In order to do this, you must use the same cookie-path for both sites.
After installation, open the
wp-config.php
file in Site B’s installation root, and add (or replace) the following lines shortly after the database configuration, modifying them as needed to fit your configuration:Note that this will only work if the two installations reside on the same domain (which yours do!).
An alternate solution would be to setup the entire system as a single multisite installation.
Still another solution (albeit one that requires more legwork) would be to employ custom page templates on a single installation.
I have released a wordpress plugin based on the following article:
http://subinsb.com/set-same-cookie-on-different-domains
User Session Synchronizer allows you to keep the user logged in from one wordpress to another by synchronizing user data and cookie session based on a verified email.
The user email is encrypted based on the current user ip and a secret key shared by the synchronized wordpress installations.
You can find the plugin here:
https://wordpress.org/plugins/user-session-synchronizer/
And participate here:
https://github.com/rafasashi/user-session-synchronizer