How to connect two databases?

242 Views Asked by At

I have a site that's has got 2 open source programs installed. Elgg and Osclass. Both are great, but the problem is they each have their own database and therefore users must register a seperate account on each site. Is their any way to link the two databases (on cpanel) so that an account created on one will automatically be created on the other as well.

2

There are 2 best solutions below

0
Lajos Arpad On

Since they are open source, you can modify their source-code. So you will need to do the following things:

  1. Write your own function which takes an Elgg user as an argument and creates an OsClass user for it. func1

  2. Write your own function which takes an OsClass user and creates an Elgg user for it. func2

  3. Write your own function which takes an existing Elgg user and finds the corresponding OsClass user. func3

  4. Write your own function which takes and existing OsClass user and finds the corresponding Elgg user for it. func4

  5. Modify Elgg to make sure that func1 is called just after an Elgg user was successfully created.

  6. Modify OsClass to make sure that func2 is called just after an OsClass user was successfully created.

  7. Make sure that whenever a user is removed, you call either func3 or func4, to get the corresponding user from the other database and remove that user.

2
Nacho Pavon On

You can use SAML (simplesamlphp) to get a Single Sign On service to start a session on both platforms with the same users. There are plugins for elgg to do this (https://elgg.org/plugins/1939508) and it shouldn be difficult to get it to work in osClass.