3

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

3

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.

4
  • Thanks, but my problem is different. I want to use different database.This is the main point; different databases. So i want to use different wordpress installation with different database, but also i want to use shared members. For example i have 2 installation wpA and wpB. And i am using dbA for wpA and dbB for wpB. What i need is, wpB can use wpA members (ond dbA) for authantication and registration.I mean, if somebody want to register to site on wpB, this registration should save on dbA. If somebody logged in on wpA , they can logged in wpB same time.. Help me please.
    – Rasih
    Oct 26, 2012 at 16:47
  • 1
    You can't then. You have to combine the installations with the different table prefixes like mentioned above.
    – Nicole
    Oct 26, 2012 at 17:06
  • 1
    A little late, but maybe someone else runs into this question: I don't see any problem with this solution, given the two databases are on the same MySQL instance. As long as the MySQL user WordPress uses to connect has access to both databases you should be able to use define('CUSTOM_USER_TABLE', 'databasename1.wp123_users'); in the second WP instance to use the table from the first database. If the two databases are on separate instances this is not an option though. Oct 15, 2014 at 7:04
  • @GeraldSchneider I did not think about that when answering this question. That should work for what this person wanted.
    – Nicole
    Mar 2, 2015 at 16:20
0

Since they are on the same server, I think you can probably do this. However, my PHP is not that great, so this is just a starting point.

http://codex.wordpress.org/Editing_wp-config.php#Custom_User_and_Usermeta_Tables

1
  • Thanks, for your idea, but it is not solution for me. If i know, how can i include ConfigA database information to config B, and if i know how can i define some user tables and set to A tables for B using, i can do. But i need exact solution, because i have to do that, i need it. If anyone experinced about this subject, please offer me a solution.
    – Rasih
    Oct 25, 2012 at 23:32

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.