diff --git a/domain.admin.inc b/domain.admin.inc
index df8e66e..32e1f1b 100644
--- a/domain.admin.inc
+++ b/domain.admin.inc
@@ -175,36 +175,6 @@ function domain_configure() {
  * FormsAPI for configuring the domain module.
  */
 function domain_configure_form($form, &$form_state, $user_submitted = FALSE) {
-  $form['domain_behavior'] = array(
-    '#type' => 'radios',
-    '#title' => t('New content settings'),
-    '#required' => TRUE,
-    '#default_value' => (int) variable_get('domain_behavior', DOMAIN_INSTALL_RULE),
-    '#options' => array(1 => t('Show on all affiliate sites'), 2 => t('Only show on selected sites')),
-    '#description' => t('If set to <em>Show on all affiliate sites</em>, this value will automatically assign new content to all affiliates.')
-  );
-  $node_types = node_type_get_names();
-  $form['domain_node'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Send to all affiliates'),
-    '#collapsible' => TRUE,
-    '#collapsed' => FALSE,
-    '#states' => array(
-      'visible' => array(
-        ':input[name=domain_behavior]' => array('value' => '2'),
-      ),
-    ),
-  );
-  foreach ($node_types as $key => $value) {
-    $form['domain_node']['domain_node_' . $key] = array(
-      '#type' => 'checkbox',
-      '#title' => check_plain($value),
-      '#default_value' => variable_get('domain_node_' . $key, 0),
-    );
-  }
-  $form['domain_node']['message'] = array(
-    '#markup' => t('If new content is set to "Show on all affiliate sites," these settings will be ignored.'),
-  );
   $form['domain_sitename_override'] = array(
     '#type' => 'checkbox',
     '#title' => t('Override site name with name of domain.'),
@@ -702,26 +672,6 @@ function domain_delete_form_submit($form, &$form_state) {
  */
 function domain_advanced_form($form, &$form_state) {
   $form = array();
-  $node_types = node_type_get_names();
-  // In D7, type handling is strict, so make this value 0 or 1.
-  // @TODO: clean up DOMAIN_INSTALL handling.
-  $default = (int) variable_get('domain_behavior', DOMAIN_INSTALL_RULE);
-  if ($default == 2) {
-    $default = 0;
-  }
-  $form['domain_node'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Domain node types'),
-    '#collapsible' => TRUE
-  );
-  $form['domain_node']['intro'] = array('#value' => t('<p>Check the content types that should be published to all affiliates when new content is created.</p>'));
-  foreach ($node_types as $key => $value) {
-    $form['domain_node']['domain_node_' . $key] = array(
-      '#type' => 'checkbox',
-      '#title' => check_plain($value),
-      '#default_value' => variable_get('domain_node_' . $key, $default),
-    );
-  }
   // Some editors will not have full node editing permissions.  This allows us
   // to give selected permissions for nodes within the editor's domain.
   $form['domain_form'] = array(
@@ -1077,6 +1027,78 @@ function domain_batch_form_submit($form, &$form_state) {
 }
 
 /**
+ * FormAPI to set default domain settings per content type.
+ */
+function domain_nodes_form($form, &$form_state) {
+  $form = array();
+
+  $node_types = node_type_get_names();
+  $options = array(DOMAIN_ALL => t('All domains'), DOMAIN_ACTIVE => t('Author\'s currently active domain'));
+  foreach (domain_domains() as $key => $value) {
+    $options[$value['machine_name']] = $value['sitename'];
+  }
+
+  foreach ($options as $key => $value) {
+    $form['#domain_node'][$key] = $value;
+  }
+
+  foreach ($node_types as $type => $name) {
+    $default_values = domain_default_node_access_settings($type);
+    $form['domain_node']['domain_node_' . $type] = array(
+      '#type' => 'checkboxes',
+      '#tree' => TRUE,
+      '#options' => $options,
+      '#default_value' => $default_values,
+    );
+  }
+
+  $form = system_settings_form($form);
+  // System settings form adds a theme we cannot use.
+  unset($form['#theme']);
+  return $form;
+}
+
+/**
+ * FormsAPI theming.
+ */
+function theme_domain_nodes_form($variables) {
+  $form = $variables['form'];
+  $output = '<p>' . t('You may set default domain publishing options to the content types when new content will be created. When you publish to <em>All domains</em>, you can additionally define domain memberships.') . '</p>';
+  $num_columns = 15;
+  $node_types = node_type_get_names();
+  $num_node_types = count($node_types);
+
+  for ($i = 0; $i < $num_node_types; $i += $num_columns) {
+    $header = array(t('Domains'));
+    $rows = array();
+    $count = 0;
+    $used_node_types = array();
+    foreach ($node_types as $type => $name) {
+      if($count == $num_columns) {
+        break;
+      }
+      $header[] = $name;
+      $used_node_types[$type] = $name;
+      array_shift($node_types);
+      $count++;
+    }
+    foreach ($form['#domain_node'] as $key => $sitename) {
+      $row = array();
+      $row[] = filter_xss_admin($sitename);
+      foreach ($used_node_types as $type => $name) {
+        $form['domain_node']['domain_node_' . $type][$key]['#title'] = '';
+        $row[] = drupal_render($form['domain_node']['domain_node_' . $type][$key]);
+      }
+      $rows[] = $row;
+    }
+    $output .= theme('table', array('header' => $header, 'rows' => $rows));
+  }
+
+  $output .= drupal_render_children($form);
+  return $output;
+}
+
+/**
  * FormsAPI to set default domain membership for each role.
  *
  * These settings are added to the $user object.
diff --git a/domain.install b/domain.install
index 9caa876..d258f5b 100644
--- a/domain.install
+++ b/domain.install
@@ -81,7 +81,6 @@ function domain_schema() {
  */
 function domain_uninstall() {
   $variables = array(
-    'domain_behavior',
     'domain_bootstrap_modules',
     'domain_classes',
     'domain_cron_rule',
@@ -113,6 +112,55 @@ function domain_uninstall() {
 }
 
 /**
+ * Checks module requirements.
+ */
+function domain_requirements($phase) {
+  $requirements = array();
+  switch ($phase) {
+    case 'install':
+      module_load_include('module', 'domain');
+      $root = strtolower(rtrim($_SERVER['HTTP_HOST']));
+      if ($error = domain_valid_domain($root)) {
+        $requirements['domain'] = array(
+          'title' => t('Domain Access'),
+          'value' => $error . t('If you are using drush, please provide the --uri option (e.g. drush en domain --uri="http://example.com/optional_subdirectory").'),
+          'severity' => REQUIREMENT_ERROR,
+        );
+      }
+      break;
+    case 'runtime':
+      $messages = array();
+      $severity = REQUIREMENT_ERROR;
+      // Ensure we have a primary domain.
+      $check = domain_default();
+      if ($check['domain_id'] == 0) {
+        $updated = t('set by an administrator');
+        if (user_access('administer domains')) {
+          $updated = l(t('set properly'), 'admin/structure/domain');
+        }
+        $messages[] = t('The site has no primary domain and needs to be !updated.', array('!updated' => $updated));
+      }
+      // Check for domain_id 0.
+      $list = domain_update_module_check();
+      domain_update_messages($messages, $list);
+
+      // Now report.
+      $t = get_t();
+      if (empty($message)) {
+        $severity = REQUIREMENT_OK;
+        $messages[] = t('Module installed correctly.');
+      }
+      $requirements['domain'] = array(
+        'title' => $t('Domain Access'),
+        'value' => theme('item_list', array('items' => $messages)),
+        'severity' => $severity,
+      );
+      break;
+  }
+  return $requirements;
+}
+
+/**
  * Update note.
  *
  * Upgrading from Drupal 5 to Drupal 7 is not supported.
@@ -332,50 +380,23 @@ function domain_update_machine_name($subdomain) {
 }
 
 /**
- * Checks module requirements.
+ * Replace domain_behavior with default node access settings.
  */
-function domain_requirements($phase) {
-  $requirements = array();
-  switch ($phase) {
-    case 'install':
-      module_load_include('module', 'domain');
-      $root = strtolower(rtrim($_SERVER['HTTP_HOST']));
-      if ($error = domain_valid_domain($root)) {
-        $requirements['domain'] = array(
-          'title' => t('Domain Access'),
-          'value' => $error . t('If you are using drush, please provide the --uri option (e.g. drush en domain --uri="http://example.com/optional_subdirectory").'),
-          'severity' => REQUIREMENT_ERROR,
-        );
-      }
-      break;
-    case 'runtime':
-      $messages = array();
-      $severity = REQUIREMENT_ERROR;
-      // Ensure we have a primary domain.
-      $check = domain_default();
-      if ($check['domain_id'] == 0) {
-        $updated = t('set by an administrator');
-        if (user_access('administer domains')) {
-          $updated = l(t('set properly'), 'admin/structure/domain');
-        }
-        $messages[] = t('The site has no primary domain and needs to be !updated.', array('!updated' => $updated));
-      }
-      // Check for domain_id 0.
-      $list = domain_update_module_check();
-      domain_update_messages($messages, $list);
-
-      // Now report.
-      $t = get_t();
-      if (empty($message)) {
-        $severity = REQUIREMENT_OK;
-        $messages[] = t('Module installed correctly.');
+function domain_update_7308(&$sandbox) {
+  $behavior = variable_get('domain_behavior', 0);
+  if (function_exists('node_type_get_types')) {
+    $types = node_type_get_types();
+    foreach ($types as $key => $type) {
+      $node_access_values = array('DOMAIN_ACTIVE');
+      $all_sites = variable_get('domain_node_' . $key, 0);
+      if ($behavior == 1 || $all_sites == 1) {
+        $node_access_values[] = 'DOMAIN_ALL';
       }
-      $requirements['domain'] = array(
-        'title' => $t('Domain Access'),
-        'value' => theme('item_list', array('items' => $messages)),
-        'severity' => $severity,
-      );
-      break;
+      variable_set('domain_node_' . $key, $node_access_values);
+    }
   }
-  return $requirements;
+  variable_del('domain_behavior');
+
+  return t('Ported domain behavior to default node access settings.');
 }
+
diff --git a/domain.module b/domain.module
index 9f3199b..f15ff37 100644
--- a/domain.module
+++ b/domain.module
@@ -42,6 +42,12 @@ define('DOMAIN_EXPORT_STATUS_DATABASE', 0);
 define('DOMAIN_EXPORT_STATUS_CODE', 1);
 
 /**
+ * Defines constants for content settings.
+ */
+define('DOMAIN_ALL','DOMAIN_ALL');
+define('DOMAIN_ACTIVE', 'DOMAIN_ACTIVE');
+
+/**
  * Module setup tasks.
  *
  * 1. Adds the domain user data to the $user object.
@@ -207,7 +213,7 @@ function domain_menu() {
     'type' => MENU_DEFAULT_LOCAL_TASK,
     'file' => 'domain.admin.inc',
     'description' => 'View domains for the site.',
-    'weight' => -12
+    'weight' => -50,
   );
   $items['admin/structure/domain/settings'] = array(
     'title' => 'Settings',
@@ -216,7 +222,7 @@ function domain_menu() {
     'page callback' => 'domain_configure',
     'file' => 'domain.admin.inc',
     'description' => 'Configure Domain Access settings.',
-    'weight' => -8
+    'weight' => -20,
   );
   $items['admin/structure/domain/create'] = array(
     'title' => 'Create domain',
@@ -226,7 +232,6 @@ function domain_menu() {
     'page arguments' => array('domain_form'),
     'file' => 'domain.admin.inc',
     'description' => 'Create new domain record.',
-    'weight' => -7
   );
   // Register the batch actions as menu callbacks
   $batch = module_invoke_all('domain_batch');
@@ -238,7 +243,7 @@ function domain_menu() {
       'page callback' => 'domain_batch',
       'file' => 'domain.admin.inc',
       'description' => 'Batch update domain settings.',
-      'weight' => -5
+      'weight' => -15,
     );
     // Get the submenu items
     foreach ($batch as $key => $value) {
@@ -254,6 +259,16 @@ function domain_menu() {
       );
     }
   }
+  $items['admin/structure/domain/nodes'] = array(
+    'title' => 'Content defaults',
+    'access arguments' => array('administer domains'),
+    'type' => MENU_LOCAL_TASK,
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('domain_nodes_form'),
+    'file' => 'domain.admin.inc',
+    'description' => 'Default domain settings for content.',
+    'weight' => -10,
+  );
   $items['admin/structure/domain/roles'] = array(
     'title' => 'User defaults',
     'access arguments' => array('administer domains'),
@@ -262,7 +277,7 @@ function domain_menu() {
     'page arguments' => array('domain_roles_form'),
     'file' => 'domain.admin.inc',
     'description' => 'Default domain settings for users.',
-    'weight' => -4
+    'weight' => -5,
   );
   $items['admin/structure/domain/view/%domain'] = array(
     'title' => 'View',
@@ -405,6 +420,10 @@ function domain_theme($existing, $type, $theme, $path) {
       'variables' => array('batch' => array()),
       'file' => 'domain.admin.inc',
     ),
+    'domain_nodes_form' => array(
+      'render element' => 'form',
+      'file' => 'domain.admin.inc',
+    ),
     'domain_roles_form' => array(
       'render element' => 'form',
       'file' => 'domain.admin.inc',
@@ -1634,11 +1653,12 @@ function domain_node_load($nodes, $types) {
     if (!isset($node->nid)) {
       continue;
     }
-    // Append the domain grants to the node for editing.
+    // Get default settings.
+    $defaults = domain_get_node_defaults($node->type);
     // Append the domain grants to the node for editing.
     $nodes[$node->nid]->domains = isset($domains[$node->nid]['domain_id']) ? $domains[$node->nid]['domain_id'] : array();
     // If the node is not assigned, grant to all domains to prevent errors.
-    $nodes[$node->nid]->domain_site = isset($domains[$node->nid]['domain_site']) ? $domains[$node->nid]['domain_site'] : variable_get('domain_behavior', DOMAIN_INSTALL_RULE);
+    $nodes[$node->nid]->domain_site = isset($domains[$node->nid]['domain_site']) ? $domains[$node->nid]['domain_site'] : $defaults['domain_site'];
     $nodes[$node->nid]->subdomains = array();
     if (!empty($nodes[$node->nid]->domain_site)) {
       $nodes[$node->nid]->subdomains[] = t('All affiliates');
@@ -1943,8 +1963,6 @@ function domain_node_grants($account, $op) {
  *
  */
 function domain_node_access_records($node) {
-  $_domain = domain_get_domain();
-
   // Define the $grants array.
   $grants = array();
   // Check to see if the node domains were set properly.
@@ -1952,9 +1970,9 @@ function domain_node_access_records($node) {
   // means we have to add the logic from hook_form_alter() here.
   if (!isset($node->domain_site)) {
     // We came from a separate source, so let's set the proper defaults.
-    $node->domain_site = variable_get('domain_node_' . $node->type, variable_get('domain_behavior', DOMAIN_INSTALL_RULE));
-    // And the currently active domain.
-    $node->domains = array($_domain['domain_id'] => $_domain['domain_id']);
+    $defaults = domain_get_node_defaults($node->type, array(domain_get_domain()));
+    $node->domain_site = $defaults['domain_site'];
+    $node->domains = $defaults['domain_id'];
   }
 
   // If the form is hidden, we are passed the 'domains_raw' variable.
@@ -2213,7 +2231,7 @@ function domain_enable() {
   // manually define our records if none are present.
   $count = (bool) db_query_range("SELECT 1 FROM {domain_access}", 0, 1)->fetchField();
   if (empty($count)) {
-    $rule = variable_get('domain_behavior', DOMAIN_INSTALL_RULE);
+    $rule = DOMAIN_INSTALL_RULE;
     $site = DOMAIN_SITE_GRANT;
     $values = array();
     $result = db_query("SELECT nid FROM {node}");
@@ -2307,25 +2325,19 @@ function domain_form_alter(&$form, &$form_state, $form_id) {
   global $user;
   $_domain = domain_get_domain();
 
-  // By default, the requesting domain is assigned.
-  $default = array($_domain['domain_id']);
+  // Get the default assigned domains.
+  $defaults = domain_get_node_defaults($form['#node']->type);
   // How is core content handled for this site?
   // In D7, type handling is strict, so make this value 0 or 1.
   // @TODO: clean up DOMAIN_INSTALL handling.
-  $all_sites = (int) variable_get('domain_behavior', DOMAIN_INSTALL_RULE);
-  if ($all_sites == 1) {
-    $behavior = 1;
-  }
-  else {
-    $behavior = variable_get('domain_node_' . $form['#node']->type, 0);
-  }
+  $default_domain_site = (int) $defaults['domain_site'];
 
   // Some options will be passed as hidden values, we need to run some checks on those.
   if (isset($form['#node']->nid)) {
     $raw = $form['#node']->domains;
   }
   else {
-    $raw = $default;
+    $raw = $defaults['domain_id'];
   }
 
   $options = array();
@@ -2354,7 +2366,7 @@ function domain_form_alter(&$form, &$form_state, $form_id) {
       '#title' => t('Send to all affiliates'),
       '#required' => FALSE,
       '#description' => t('Select if this content can be shown to all affiliates. This setting will override the options below, but you must still select a domain that "owns" this content.'),
-      '#default_value' => (isset($form['#node']->domain_site)) ? $form['#node']->domain_site : $behavior,
+      '#default_value' => (isset($form['#node']->domain_site)) ? $form['#node']->domain_site : $default_domain_site,
     );
     $form['domain']['domains'] = array(
       '#type' => empty($format) ? 'checkboxes' : 'select',
@@ -2362,7 +2374,7 @@ function domain_form_alter(&$form, &$form_state, $form_id) {
       '#options' => $options,
       '#required' => TRUE,
       '#description' => t('Select which affiliates can access this content.'),
-      '#default_value' => (isset($form['#node']->domains)) ? $form['#node']->domains : $default,
+      '#default_value' => (isset($form['#node']->domains)) ? $form['#node']->domains : $defaults['domain_id'],
     );
     if ($format) {
       $form['domain']['domains']['#multiple'] = TRUE;
@@ -2491,7 +2503,7 @@ function domain_form_alter(&$form, &$form_state, $form_id) {
     // These form elements are hidden from non-privileged users, by design.
     $form['domain_site'] = array(
       '#type' => 'value',
-      '#value' => (isset($form['#node']->domain_site)) ? $form['#node']->domain_site : $behavior,
+      '#value' => (isset($form['#node']->domain_site)) ? $form['#node']->domain_site : $default_domain_site,
     );
     // Domains that have been assigned and cannot be changed.
     $form['domains_raw'] = array(
@@ -2502,6 +2514,36 @@ function domain_form_alter(&$form, &$form_state, $form_id) {
 }
 
 /**
+ * Implements hook_form_FORM_ID_alter().
+ *
+ * Adds configurable default settings to the node type edit form.
+ *
+ */
+function domain_form_node_type_form_alter(&$form, &$form_state, $form_id) {
+  $options = array(DOMAIN_ALL => t('All domains'), DOMAIN_ACTIVE => t('Author\'s currently active domain'));
+  foreach (domain_domains() as $key => $value) {
+    $options[$value['machine_name']] = $value['sitename'];
+  }
+  $default_values = domain_default_node_access_settings($form['#node_type']->type);
+  $form['domain'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Domain access settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+    '#group' => 'additional_settings',
+    '#access' => user_access('set domain access'),
+  );
+  $form['domain']['domain_node'] = array(
+    '#title' => t('Publish to'),
+    '#description' => t('You may set default domain publishing options when new content of this type will be created. When you publish to <em>All domains</em>, you can additionally define domain memberships.'),
+    '#type' => 'checkboxes',
+    '#tree' => TRUE,
+    '#options' => $options,
+    '#default_value' => $default_values,
+  );
+}
+
+/**
  * Update the default domain's sitename.
  */
 function domain_form_system_site_information_settings_alter(&$form, &$form_state) {
@@ -3929,3 +3971,100 @@ function domain_migrate_api() {
   );
   return $api;
 }
+
+/**
+ * Returns default node access settings, ready for a node object.
+ *
+ * Use domain_default_node_access_settings() when you need those settings in
+ * forms, or when you look for default access settings in general.
+ *
+ * First level keys are
+ *  - 'domain_site' (publish to all affiliates) with value TRUE or FALSE.
+ *  - 'domain_id' contains the assigned affiliates, where both keys and values
+ *    are the domain id.
+ *
+ * Array of assigned domains can be empty, but only if an admin explicitly
+ * defined this. Use $fallback_domains to prevent zero assignments.
+ * See domain_default() as an example for a possible fallback domain.
+ *
+ * @see domain_default_node_access_settings()
+ * @see domain_default()
+ *
+ * @param $type
+ *  The type of the node (like 'article').
+ * @param $fallback_domains (optional)
+ *  An array of domains which are used if no default domain is assigned.
+ *
+ * @return
+ *  An array of default settings, formatted as explained above.
+ */
+function domain_get_node_defaults($type, $fallback_domains = array()) {
+  $_domain = domain_get_domain();
+  $defaults = array('domain_id' => array());
+  // We use array_flip for compatibility with node_type_form_submit().
+  $settings = array_flip(domain_default_node_access_settings($type));
+  $domains = domain_domains();
+
+  $defaults['domain_site'] = isset($settings['DOMAIN_ALL']) ? TRUE : FALSE;
+  // Assign the currently active domain, if not disabled by user.
+  if (isset($settings['DOMAIN_ACTIVE'])) {
+    $defaults['domain_id'][$_domain['domain_id']] = $_domain['domain_id'];
+  }
+  // Assign the default affiliates.
+  foreach ($domains as $domain) {
+    if (isset($settings[$domain['machine_name']])) {
+      $defaults['domain_id'][$domain['domain_id']] = $domain['domain_id'];
+    }
+  }
+  // Use fallback domains when no default affiliate exists.
+  if (empty($defaults['domain_id']) && !empty($fallback_domains)) {
+    foreach ($fallback_domains as $domain) {
+      $defaults['domain_id'][$domain['domain_id']] = $domain['domain_id'];
+    }
+  }
+  return $defaults;
+}
+
+/**
+ * Returns default node access settings for new content.
+ *
+ * Usually, you may use this function in forms, and when you look for default
+ * access settings in general.
+ * Use domain_get_node_defaults() when you need an array for a node object.
+ *
+ * @see domain_get_node_defaults()
+ *
+ * @param $type
+ *  The node type (like 'article').
+ *
+ * @return
+ *  An array of default settings.
+ */
+function domain_default_node_access_settings($type) {
+  // We need to know if there are user-defined settings.
+  // If so, we get an array, though it could be empty.
+  $settings = variable_get('domain_node_' . $type, NULL);
+  // Append default behavior, if there are no user-defined settings.
+  if (is_null($settings)) {
+    // Assign the currently active domain.
+    $settings = array(0 => 'DOMAIN_ACTIVE');
+    // And publish to all domains when rule allows it.
+    if (DOMAIN_INSTALL_RULE) {
+      $settings[] = 'DOMAIN_ALL';
+    }
+  }
+  // When configured on domain nodes form,
+  // keep the structure equal to the node type pattern.
+  elseif (isset($settings['DOMAIN_ALL'])) {
+    $old_settings = $settings;
+    // Reset settings array and fill it with correct pattern.
+    $settings = array();
+    foreach ($old_settings as $key => $value) {
+      // Machine_name could be of value 0. The second condition covers this special case.
+      if ($value !== 0 || ($key === 0 && $value === 0)) {
+        $settings[] = $value;
+      }
+    }
+  }
+  return $settings;
+}
diff --git a/domain_content/domain_content.module b/domain_content/domain_content.module
index 92dc42f..5ce5dbe 100644
--- a/domain_content/domain_content.module
+++ b/domain_content/domain_content.module
@@ -235,7 +235,7 @@ function domain_content_add_form_widget(&$form) {
     '#title' => t('Send to all affiliates'),
     '#required' => FALSE,
     '#description' => t('Select if this content can be shown to all affiliates.  This setting will override the options below.'),
-    '#default_value' => variable_get('domain_behavior', DOMAIN_INSTALL_RULE),
+    '#default_value' => DOMAIN_INSTALL_RULE,
   );
   $form['domain']['domains'] = array(
     '#type' => empty($format) ? 'checkboxes' : 'select',
diff --git a/tests/domain.test b/tests/domain.test
index b3ba491..684e974 100644
--- a/tests/domain.test
+++ b/tests/domain.test
@@ -94,6 +94,16 @@ class DomainTestCase extends DrupalWebTestCase {
   }
 
   /**
+   * Helper function for form introspection.
+   */
+  public function domainNodeForm($uid, $type) {
+    $user = user_load($uid);
+    $node = (object) array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => LANGUAGE_NONE);
+    module_load_include('inc', 'node', 'node.pages');
+    return drupal_get_form($type . '_node_form', $node);
+  }
+
+  /**
    * Set the global $base_url to a domain.
    *
    * Required so that POST and other url() requests can be routed properly.
@@ -1050,3 +1060,69 @@ class DomainSitenameTest extends DomainTestCase {
     $this->assertText($sitename_new, 'Frontpage shows site name instead of domain name.');
   }
 }
+
+class DomainSettingsTest extends DomainTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Module settings',
+      'description' => 'Tests configuration options for the module.',
+      'group' => 'Domain Access',
+    );
+  }
+
+  function setUp($list = array()) {
+    parent::setUp($list);
+    $this->domainCreateDomains();
+  }
+
+  // Test the settings for adding content.
+  function testDomainContentSettings() {
+    $domains = domain_domains(TRUE);
+    $this->assertTrue(count($domains) == 4, 'Four test domains created.');
+    // Check that no values are set.
+    $value = variable_get('domain_node_article', NULL);
+    $this->assertNull($value, 'No settings for creating articles.');
+    // The default values should be present for 'article'.
+    $defaults = domain_default_node_access_settings('article');
+    $this->assertTrue(count($defaults) == 2, 'Two options set for articles.');
+    $this->assertTrue(in_array(DOMAIN_ALL, $defaults), 'All domains selected by default');
+    $this->assertTrue(in_array(DOMAIN_ACTIVE, $defaults), 'Active domain selected by default');
+
+    // Test the node edit form.
+    $type = 'article';
+    $uid = 1;
+    $form = $this->domainNodeForm($uid, $type);
+    // Are the default values set as expected?
+    $this->assertTrue(!empty($form['domain']['domain_site']['#default_value']), 'All affiliates selected when editing.');
+    $_domain = domain_get_domain();
+    $expected = array($_domain['domain_id'] => $_domain['domain_id']);
+    $this->assertEqual($form['domain']['domains']['#default_value'], $expected, 'Active domain selected when editing.');
+
+    // Now let's change the settings and test again.
+    $settings = array();
+    foreach ($domains as $domain) {
+      if (!$domain['is_default']) {
+        $settings[] = $domain['machine_name'];
+      }
+    }
+    variable_set('domain_node_article', $settings);
+    $defaults = variable_get('domain_node_article', NULL);
+    $this->assertTrue(count($defaults) == 3, 'Three options set for articles.');
+    $this->assertFalse(in_array(DOMAIN_ALL, $defaults), 'All domains not selected by default');
+    $this->assertFalse(in_array(DOMAIN_ACTIVE, $defaults), 'Active domain not selected by default');
+
+    // Test the node edit form again.
+    $type = 'article';
+    $uid = 1;
+    $form = $this->domainNodeForm($uid, $type);
+    // Are the default values set as expected?
+    $this->assertTrue(empty($form['domain']['domain_site']['#default_value']), 'All affiliates not selected when editing.');
+    $_domain = domain_get_domain();
+    $this->assertFalse(in_array($_domain['domain_id'], $form['domain']['domains']['#default_value']), 'Active domain not selected when editing.');
+    foreach ($defaults as $machine_name) {
+      $id = domain_load_domain_id($machine_name);
+      $this->assertTrue(in_array($id, $form['domain']['domains']['#default_value']), t('Domain %id set properly as a default.', array('%id' => $id)));
+    }
+
+  }
+}
