WordPress.org

Ready to get started?Download WordPress

Forums

how to share users between separate databases (3 posts)

  1. agibbon
    Member
    Posted 1 year ago #

    I have a site that is built up of 9 different wordpress sites all with their own databases.

    All the sites are on the same server and all come under the same domain. eg http://www.example.com/wordpress1 http://www.example.com/wordpress2 etc

    Is it possible to share users between each site and databases? For example, if a user signed up to one site, they will then be signed in all the other sites as well?

    I have had a look on-line but all the forums talk about using the same database on wordpress multi site.

    really stuck here! Thanks.

  2. Hmmm.... here is what I'm thinking...

    1. Create your php to hold all the variables for your multiple database login credentials.. basically, make nine different $wpdb instances.

    2. Hook to a new user action... probably the user_register hook.

    3. Write your function to grab their database info... and populate it to each of the nine other databases.

    4. CAVEAT - User id's are not going to match.. wreaking havoc... unless you start it from the beginning.

  3. agibbon
    Member
    Posted 1 year ago #

    You don't think we can get users id working then?

    I'm not the greatest when it comes to php so could you give example of the php for each step?

    The way we have the sites set up, we have to have each site needs its own database.

    thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic