I’ve successfully set up a multisite Drupal installation. I now have:
www.example.com –> main site sub.example.com –> a secondary site
However, I want the users to be shared. I know about shared databases and prefixes, but according to the comments in the settings.php, you can also use the prefixes to access a different database. I’d like to choose that root.
So my main site goes to the primary database, the subdomain goes to the secondary database, except for the users.
This is relevant section of the settings.php of my subdomain:
$databases = array ( 'default' => array ( 'default' => array ( 'database' => 'secondary_database', 'username' => 'username', 'password' => 'password', 'host' => 'localhost', 'port' => '', 'driver' => 'mysql', 'prefix' => array( 'default' => '', 'users' => 'primary_database.', 'sessions' => 'primary_database.', 'role' => 'primary_database.', 'authmap' => 'primary_database.', ), ), ), );
My primary database already has many users, but when I log into my secondary site, I only see my admin user. Also, I cannot log in to my subdomain with any user of my primary database.
So my conclusion is that the subdomain is still using its own database.
Both databases are on the same server and I’ve given the username/password for the secondary database access to the primary database.
There are also no errors in the log.
Any suggestions on what I’m missing?
Sponsored by SupremePR