Drush Commands

Domain Access 7.x.3.x supports Drush version 3.x and higher. The following commands are available. Type 'drush help' for more information.

drush domain-list

Shows a table of the domains registered for your site. You may use 'drush domains' as a shortcut command.

drush domain-add DOMAIN 'SITENAME' --options

Add a new domain to your site. The DOMAIN parameter is required and must be unique and validly formed (e.g. example.com). Possible options are:

  • inactive=1/0: Set the domain to inactive by passing 1. Default is 0.
  • https=1/0: Set the domain to use https instead of http by passing 1. Default is 0.
  • weight=X: Set the weight of the domain to an integer value. Default is 0.

Sample command:
drush domain-add example.com 'My New Site' --https=1

Will create the domain:

  • sitename: My New Site
  • subdomain: example.com
  • valid: yes
  • scheme: https://
  • weight: 0

drush generate-domains BASE_DOMAIN --count=15

Autogenerate a set of domains for testing. Aliased to 'drush gend'. Will use the provided BASE_DOMAIN as the primary domain, defaulting to 'example.com'.

Developer notes

The Domain Access module is meant to be the core module for a system of small modules which add functionality.

Extension Modules

Currently, the following modules are included in the download. They are not required, but each adds functionality to the core module.

  • Domain Alias -- Allows advanced handling of domain name matching. Use this module to treat multiple domains as though they were identical.
  • Domain Configuration -- Allows you to change select system variables for each domain, such as offline status, footer message and default home page.
  • Domain Content -- Provides a content administration page for each domain, so that affiliate editors can administer content for their section of the site.
  • Domain Navigation -- Supplies a navigation block with three themes. Creates menu items for each domain, suitable for using as primary or secondary links.
  • Domain Prefix -- A powerful module that allows for selective table prefixing for each domain in your installation.
  • Domain Source -- Allows editors to specify a primary "source" domain to be used when linking to content from another domain.

Node Access

The Domain Access module is a node_access() module. For additional developer information, see http://api.drupal.org/api/group/node_access.

By design, the module sets access to content based on the current domain that a user is viewing. If a user is at one.example.com, they can see content that is assigned to that domain or to all domains.

Assigning Domain Access

Users who have the 'Set domain access status for all content' permission can assign any node to any or all registered sites. During node editing, a series of options will be displayed as checkboxes or a multiple select list under the heading "Domain access options":

  Publishing options:
    []  Send to all affiliates
    Select if this content can be shown to all affiliates. This setting will
    override the options below.
  Publish to: * (required)
    [] Drupal
    [] One site
    [] Two site
    Select which affiliates can access this content.

If you select 'Send to all affiliates,' the node will be viewable on all domains for your site. Even if you select this option, you must select at least one domain for the node.

When creating new content, the currently active domain will be selected for you by default. You can change this behaviour with the Content Defaults feature in the Advanced Module Configuration.

Blocks

The Domain Access module provides two blocks, which can be used to help you debug your use of the module.

Block -- Domain Switcher

The Domain Switcher block presents a list of all active domains. Clicking on one of the links will take you from your current URL to the same URL on the selected domain.

For example, if you are looking at example.com/?q=node and click on another domain, the link will take you to one.example.com/?q=node.

In the Domain Switcher block, domains are listed using their human-readable site-name variables.

NOTE: This block is for debugging purposes. The included Domain Navigation module provides block and menu items intended for end users.

Block -- Domain Access Information

The Domain Access Information block lets you view node access rules for any node when you are viewing that node. This block can help you debug the module for user accounts that do not have the 'Set domain access status for all content' permission.
Fixed typos as suggested in http://drupal.org/node/1232824.
jwilson3
NOTE: By design, this block is viewable by all users. However, its content should only be shown to site developers or during debugging. You should use the normal block visibility settings as appropriate to your site.

Block -- Domain Access Server Information

Basic Module Configuration

The settings for Domain Access are listed on the Domains page (Drupal 7: Administration > Structure > Domains, or http://example.com/admin/structure/domain; Drupal 6: Administer > Build > Domains, or http://example.com/admin/build/domain)

Documentation on this page includes:

  1. Default Domain Settings
  2. Creating Domain Records
  3. Domain Module Behaviors
  4. Domain List

Default Domain Settings

These elements define the 'primary' domain for your site. In the event that a user tries to access an invalid domain, this domain will be used.

Primary Domain Name

The primary domain for your site. Typically example.com or www.example.com. Do not use http, slashes or a trailing slash. This domain will be used as the default URL for your site. If an invalid domain is requested, users will be sent to the primary domain.

Enter the primary domain for your site here.
You can also enter this value into settings.php for cookie handling when your domains all share the same base domain (example.com, one.example.com, two.example.com etc).

Permissions (Drupal 7)

After enabling the module, go to Administration > People > Permissions (http://example.com/admin/people/permissions) to configure the module's permissions.

Module Permissions

The Domain Access module has the following permissions:

Administer domain records and settings

This permission allows users to create and manage domain records and settings.

Access inactive domains

This permission allows users to navigate to domains which are marked as inactive. Users with this permission may also assign content to an inactive domain.

Assign domain editors

This permission allows users to assign themselves and other users as affiliate editors. For those users to act as editors, their role(s) must also have the 'Edit any content on assigned domains' permission.

Edit any content on assigned domains

This permission is for advanced use and substitutes for the normal 'Bypass content access control' permission for sites that give restricted administrative privileges. (See "Advanced usage", below for more information.)

Delete any content on assigned domains

This permission is for advanced use and substitutes for the normal 'Bypass content access control' permission for sites that give restricted administrative privileges. (See "Advanced usage", below for more information.)

Pages

Subscribe with RSS Subscribe to RSS - Drupal 7.x