I can't figure this one out. I want to have a single login for all users for multiple WP installs on the same domain.
I've got a site that has a wiki-type knowledgebase that uses a separate install of WordPress, but the same database. Here is how it looks:
http://mysite.com/
http://mysite.com/knowledgebase/
Both use the same database with different prefixes (wp_ and wiki_). The main site (http://mysite.com/) is where all the users will be registered. I want it to be that when they login, they are logged in both for the main site and for the knowledgebase. I know it has something to do with setting cookies, but I don't know how to do it.
Any help would be greatly appreciated! I can give more info if needed.
Thomas
Suhas Sharma answers:
This plugin would help you
http://wordpress.org/extend/plugins/root-cookie/
Though the same username-password should be present in both installations.
If you have a lot of users registering, you can add a register_form hook (in the first site) to register the same username and password pair in the second installation.
Suhas Sharma comments:
Ahh... Ivaylo's solution definitely deserves the prize money.... much cleaner approach
Ivaylo Draganov answers:
Hello,
you should be able to accomplish that without a plugin, simply by setting a few things in your <em>wp-config.php</em>. Try adding this to the file:
define('COOKIE_DOMAIN','.mysite.com');
define('COOKIEPATH', '/' );
define('SITECOOKIEPATH', '/');
Ivaylo Draganov comments:
I assume that you are using a shared users and usermeta table for both installations. E.g. you have this in your <em>wp-config.php</em> for the wiki-site:
// shared users
define('CUSTOM_USER_TABLE', 'wp_users');
define('CUSTOM_USER_META_TABLE', 'wp_usermeta');
Thomas Griffin comments:
Perfect! Thanks. :)