Hi all,

Sorry for my bad English, if u don't understand, i can try to explain better.

I develop a new module for push content into another site. I explain, I have a site that allow me create different contents, I would like push this content to another site (in "/sites/" ). My problem is : we don't know another sites so I do check repertory in my module and save database information. It's OK ! But I don't find function in drupal to implement there DB. I test :

array (size=3)
      'name' => string 'site_com_corporate' (length=18)
      'bdd' =>
        array (size=7)
          'database' => string 'site_com_corporate_dev' (length=22)
          'username' => string 'root' (length=4)
          'password' => string '' (length=0)
          'host' => string '127.0.0.1' (length=9)
          'port' => string '' (length=0)
          'driver' => string 'mysql' (length=5)
          'prefix' => string '' (length=0)
Database::addConnectionInfo($site['name'], 'default', $site['bdd']);
db_set_active($name);

The connection fail, drupal connect to default.
Thx for u help !

Comments

There is a module that works similarly (though not exactly) called Domain Access. I would check that out. It might have some additional code hints for you.