13 domains 1 codebase shared login

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
scuba_fly's picture

This question is a bit similar to what has been asked here before but my use case is a bit different.

I have 13 Drupal 7 sites that share the source code. 12 of them run the same modules / settings but look slightly different. At the moment I use 13 databases.

I have about 50 users on each site and each user has some nodes.
Every site has its own taxonomy terms but the vocabularies are mostly named similar.

My goal is to let users from site A login into site B without filling in their profile again.
I have some custom modules running that alter the user profile fields.

My first thought was to migrate all users to one database but that would give issues with the user nodes since they could have the same uid. So I have to work that out and also do this with the user nodes etc. Think this is gonna be difficult….

Then I thought to call a hook at login and let the user login checking the username and pass across all 13 databases. But then if the user is logged in his or her profile won't be filled.

I'm a developer so I don't mind writing some code but I'm not considering myself a drupal expert.

Best way would be to start from scratch and share the user table from the beginning avoiding duplicate uids.

What would be the best approach to let users login on all sites with their whole profile available ? Any recommend modules?

Comments

I can see your approach of

Garrett Albright's picture

I can see your approach of allowing the user to log in with a password from any site having problems if the user has created an account for that site anyway. You'd want to also make sure users can't create an account with a username or email address in use on any of the other databases.

At any rate, if you can figure out what database holds a user's account info, then I don't see why you can't just go ahead and also use that database to load their profile information too. You might be already halfway to a solution there.

(Drupal.org is not Twitter. Hashtags don't work.)

Thanks for your reply.

scuba_fly's picture

Thanks for your reply.

Now all 13 databases hold users account info. I would like to use a prefix in the settings file and use one database for the user accounts but that would mean migrating all users to that database. and creating hooks for user registration, update, and profile load. ( maybe that is the best solution? )

( The tag with the hastags was a suggested tag that poped up, I've edited the tags now ;) )

Virtual Sites

dpatte's picture

I have a similar situation with 13 websites that share users, but act slightly differently

www.dance-ottawa.com
www.dance-montreal.com
www.dance-toronto.com
etc

I used the module Virtual Sites. It was easy to set up, and worked perfectly. I am on Drupal 6, but there is also a version for Drupal 7.

Multisite

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: