0

Im trying to figure out how to login one time to mydomain.com and being automatically loged in to mydomain.com/blog . I have figured out how to share tables (so that the same users on my main site, are also on the blog site) through MyPHPAdmin. I was hoping in this manner, I wouldn't have to use WPMU. Any advice, or links would be GREATLY appreciated. Im currently using version 3.8.1

5
  • Sorry, but I don't understand what your goal is. It sounds more like automatic logging in into the database, rather than into the WordPress installation.
    – kaiser
    Commented Feb 17, 2014 at 17:13
  • I apologize if I didn't sound specific. Im not really sure how to word it. I would like to login as (example admin) on BOTH dashboards as a one time login. Would this be called "cross installation"
    – Ebizl
    Commented Feb 18, 2014 at 17:17
  • A Multisite installation only has one (shared) user table per default.
    – kaiser
    Commented Feb 18, 2014 at 17:53
  • yes, I successfully did that through this method mikemclin.net/single-users-table-multiple-wordpress-sites
    – Ebizl
    Commented Feb 18, 2014 at 18:09
  • Normally you can register users to as many of your subsites as you want. You can alter the settings responsible for if an admin needs to confirm the new user, etc. So if I got you right, then this is already built in and you just have to tweak your settings.
    – kaiser
    Commented Feb 18, 2014 at 18:11

2 Answers 2

1

Just wanted to add my own experience to this thread. I've tried many different configurations of WordPress cookie constants in wp-config without any luck. I'm setup in the same way as described by the OP using custom_user_table and meta_table.

I've found the session information does actually translate across different pages if you use COOKIE_DOMAIN as another answer suggested (in my case domain.com and domain.com/support) - and the session data is there but WordPress still doesn't log you in. I'm still looking into the issue. I also found I needed to define the COOKIEHASH constant for the session data to match.

define('COOKIEHASH', md5( 'domain.com') );

You also need to make sure the salts in wp-config are identical.

Also a note to other folks that might have a similar issue - you need to set and manage user capabilities for the 2nd installation and that info is stored in the 2nd installs user meta table (even though you explicity set a different custom user meta table pointing to the primary install).

0

If you have two separate WP sites and both have access to the same database, you can have one instance use the other instance's user tables by editing your wp-config.php. Since they are both the same domain, you can configure your cookie domain:

define('CUSTOM_USER_TABLE','firstsite_user_table');
define('CUSTOM_USER_META_TABLE', 'firstsite_usermeta_table');

define( 'COOKIE_DOMAIN', 'mydomain.com' );

Note: This configuration works like single sign-on (SSO) only when the sites use the same domain. This will not work if sites are on different domains.

Edited to add COOKIE_DOMAIN setting.

13
  • 2
    The asker explicitly stated that he has this part working, but needs login to work cross-installation.
    – kraftner
    Commented Feb 17, 2014 at 16:37
  • Would I need to add that on BOTH wp-configs or just the main one (which happens to be mydomain.com) ?
    – Ebizl
    Commented Feb 18, 2014 at 17:24
  • How did you configure both instances to use the same tables? You should have configured CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE in your second site; assuming that the second site has access to the same database as the first site. If you did it another way then all this might not work. The COOKIE_DOMAIN should be configured on both sites.
    – user42826
    Commented Feb 18, 2014 at 17:39
  • I used this method mikemclin.net/single-users-table-multiple-wordpress-sites, will it work?
    – Ebizl
    Commented Feb 18, 2014 at 18:10
  • 1
    @Ebizl How about trying it?
    – kaiser
    Commented Feb 18, 2014 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.