Changing database table name

I am considering using elgg as the basis for the social network on a website (http://elgg.org/).

basically I'll install it as almost a separate site (on a subdomain e.g. social.mydomain.com).

Now the problem: -I'm adding this to an existing site, so I do user registration through the site I have already made. This means I have a users table in my database. -Elgg has a users table also (different name of course), as it comes with its own registration system. But i need it to read from mine.

The question: How can I change the table the elgg reads users from (I'll add all the fields elgg needs to my users table)? I'v tried modifying it in a few places in the source code but it keeps saying fatal error. So where do I change the name of the table I want elgg to read the users from?

Any help is appreciated!! Thanks

  • I really don't recommend attempting anything like this. The users table of Elgg has very deep integration with the Elgg code base. You will end up with a lot of broken data and broken features if you try to use a non-elgg table to store the users.

    Instead you should look into migrating your users from the existing table to actual Elgg users.

    (Also, please do not post a topic to more than one group. I've deleted the duplicate post.)

  • Thanks Juho,

    Sorry, I'm new to elgg, I thought all groups were different.

    When you say migrating them... do you mean a once off thing - or perhaps a script to do this as an ongoing thing?

    I do need the existing users table as if I change this it will result in a lot of broken data and features on the existing website.

    Any recommendations?

  • So your goal is to use both sites separately but with the same users?

    The best approach depends on your needs. One option is to make a script that gets the data from your original table and saves them as ElggUser() objects to Elgg.

    However if you need to keep the use base in sync also in future, I recommend looking into PAM autentication and Elgg web services API.

    You could for example add a feature to your site that calls Elgg API every time a new user registers (and possibly updates existing user data). The feature would provide the registration data to Elgg, so an account would be automatically created to Elgg also.