2

Possible Duplicate:
How do I create a multisite, sharing users and nodes?
How to share user and user profile in a multisite environment?

My question was about the whole process to get the shared user in a multisite environment. I didn't know how to start.

I found my answer here

http://drupal.org/node/547862

As the title says I would like to share user and profile table between multisites.

I have got the main domain like example.com and then I have two subdomain site2.example.com and site3.example.com with separate db.

My 'sites' directory is:

all

modules

themes

libraries


default

files

setting.php


site2.example.com

modules

themes

libraries

files

setting.php


site3.example.com

modules

themes

libraries

files

setting.php

I know how to create multisites with separate db, modules, themes and files, now I would like to know the whole process to create a multisite with shared user and user profile. What I need to do?

Thanks in advances.

1
  • Thanks Oswald, it was me, I had a problem during the submit. I already deleted that. Commented Jul 3, 2012 at 12:54

1 Answer 1

2

Edit settings.php -> $databases

$databases['default']['default'] = array(
  'database' => 'my_db',
  'username' => 'user',
  'password' => 'pass',
  'host' => 'example',
  'prefix' => array(
    'default'   => '',
    'users'     => 'shared_db_',
    'sessions'  => 'shared_db_',
    'role'      => 'shared_db_',
    'authmap'   => 'shared_db_',
  ),
  'collation' => 'utf8_general_ci',
);

Add any other tables as required in prefix array. Have a look at settings.php as well it has lots of documentation on all these.

8
  • Thanks kantu, which settings.php? the default one or the one in the site2.example.com? Commented Jul 3, 2012 at 13:56
  • 1
    Which line is it? I've found different $databases... Commented Jul 3, 2012 at 14:15
  • 1
    Only 1 $databases will be there initially, you can add this in the end others are all examples in comments.
    – GoodSp33d
    Commented Jul 4, 2012 at 6:27
  • Hi Kantu, just to clearify, this is the first time I do it. I have 2 website and 2 db, db1 and db2. How do I write that array to make the site 2 use the user from db1? Thanks Commented Jul 4, 2012 at 8:12
  • 1
    Just put that in the end of settings.php of both sites and replace my_db, user, pass shared_db according to your setup. This way both sites will use shared_db database for users table, add any other tables if needed (profile_values, profile_fields) to the prefix array
    – GoodSp33d
    Commented Jul 4, 2012 at 8:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.