Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drupal 7 Single Sign on using settings.php

How I would go about setting up my Single Sign on with no modules in Drupal 7? I had it running in Drupal 6 but some things were changed in the settings.php file and I'm having a hard time figuring this out.

 You can also use a reference to a schema/database as a prefix. This maybe
 * useful if your Drupal installation exists in a schema that is not the default
 * or you want to access several databases from the same code base at the same
 * time.
 * Example:
 * @code
 *   'prefix' => array(
 *     'default'   => 'main.',
 *     'users'     => 'shared.',
 *     'sessions'  => 'shared.',
 *     'role'      => 'shared.',
 *     'authmap'   => 'shared.',
 *   );
 * @endcode
 * NOTE: MySQL and SQLite's definition of a schema is a database.

This is the code I need to set this up, I just don't know where to put it in my settings.php file. Any ideas?

like image 720
hus- Avatar asked Jan 28 '11 18:01

hus-


2 Answers

My setting.php file look like this :

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'driver' => 'mysql',
      'database' => 'drupal7',
      'username' => 'toto',
      'password' => 'xxxxxxxxxxxxxxx',
      'host' => 'localhost',
      'port' => '',
      'prefix' => array(
          'default'   => '',
          'users'     => 'drupal7_common.',
          'sessions'  => 'drupal7_common.',
          'role'      => 'drupal7_common.',
          'authmap'   => 'drupal7_common.',
          'languages' => 'drupal7_common.',
          'locales_source'   => 'drupal7_common.',
          'locales_target'   => 'drupal7_common.',
        ),
    ),
  ),
);
like image 117
xetrokis Avatar answered Oct 30 '22 02:10

xetrokis


The Drupal 7 style for database configuration is like so:

$databases['default']['default'] = array(
    'driver' => 'mysql',
    'database' => 'd7',
    'username' => 'drupaluser',
    'password' => '',
    'host' => '127.0.0.1',
    'port' => 33066,
    'prefix' => array(
      'node' => 'foo_',
    )
);

Based on documentation:

  • http://api.drupal.org/api/drupal/includes--database--database.inc/7/source
  • http://api.drupal.org/api/drupal/includes--database--database.inc/function/DatabaseConnection::prefixTables/7
  • http://drupal.org/node/310072

I tested it locally and it seems to work as expected.

like image 41
Josh Koenig Avatar answered Oct 30 '22 03:10

Josh Koenig