Shared Members between two different wordpress installations with different databases

I have two wordpress installations with same host with different folders. Each installation uses its own database. I mean, database are separated. I am not using one database for two wordpress installations.

My Problem: I have two different member databases. Because my wordpress installation databases are not shared. So i want to use wpA database as my main database for sharing users only. And my second wpB installation must use its own table, but only must use members from wpA database.

How can i do that ?

Summary

  • I have wordpress installations in different directories.

  • I have different databases for both installations.

  • I want to use wp installation b use wp installation a members as a default members.

  • If somebody wants to register on wordpress b, he should registered on database A automatically.

  • If somebody logged in wordpress site A using database A, they can be verified on wordpress site b without extra registration.

I don’t know English very well so if I made mistakes, I am sorry.

2 Answers
2

I had to do something similar. What you need to do first is in each of your config files define the table prefix … make sure that they are different.

Example: WordPress installation 1: wp123_ WordPress installation 2: wp124_

Your first installation would be your main installation the one with the user table you want to use. Then in the second installation’s config file you need to add this in it:

//Adding so that this blog uses the same user tables as the main

define('CUSTOM_USER_TABLE', 'wp123_users');
define('CUSTOM_USER_META_TABLE', 'wp123_usermeta');

Also what you need to do is put the sites in a shared database. So that the database name is the same, database user is the same, and database password is the same. Basically connection is the same. If this make sense.

What i have above is what will allow for two different WordPress installations to share the same user base.

Leave a Comment