First of all, this module is great! I have never stopped admire it

i'm use domain access 7.x-3.0-rc5.

I do not want to use "Publish content to any assigned domain" permission or "Show on all affiliate sites" features.

is there a feature in this version for automaticaly publish a node from subdomain to subdomain and root domain ?

or is it only can handled by create a custom module refer to http://drupal.org/node/922410 ?

Thank in advance

Comments

agentrickard’s picture

Custom module. Though if you can come up with a workable user interface for this feature, we might consider adding the new feature.

anjjriit’s picture

I have read several issue like this in D6 version.
I can't write a code so i don't know how difficulty to realize it, but i think is very good to add this feature in this version.

if you don't mind i'd like to post an idea:
is it possible to add this feature in "domain setting"
at under fieldset "Send to all affiliates" and at upper "Debugging status".

The form for this feature is like "Send to all affiliates" fieldset but with a title something like "Send to all assigned domain".

or to add a permission under "Publish content to any assigned domain " with a title something like "Publish content to assigned domain ".

So user with this permission will automaticaly publish their content to all selected affiliates domain for this user.

I'm sure there are a lot of user need this feature.

One more time, thanks a ton for released this module.

agentrickard’s picture

That's a pretty good description, actually.

I think my preference might be to move those settings to a new tab, because I think they could be very complex.

anjjriit’s picture

I'd like to create a site with around 100 teacher in a school.
each teacher need a subdomain.
They want to publish book node from every subdomain to main domain.

is your code in http://drupal.org/node/922410#comment-3492328 work in 7.x-3.dev version ?
i'm not a coder but i've try to create a submodule named domain_custom_affiliate with 2 file: domain_custom_affiliate.info and domain_custom_affiliate.module.
Then i copied your code to be

// This assumes you have a module named domain_custom_affiliate.module.
function domain_custom_affiliate_domainrecords(&$grants, $node) {
  global $_domain;
  // We only care about the book_type node.
  if ($node->type != 'book') {
    return;
  }
  $primary_set = FALSE;
  foreach ($grants as $key => $grant) {
    // Remove the domain_site grant.
    if ($grant['realm'] == 'domain_site') {
      unset($grants[$key]);
    }
    // Remove domains we don't want.
    else if ($grant['gid'] != $_domain['domain_id']) {
      unset($grants[$key]);
    }
    // Check that the primary domain is set.
    if ($grant['gid'] == 0 && $grant['realm'] == 'domain_id') {
      $primary_set = TRUE;
    }
  }
  // Make sure the primary domain is selected.
  if (!$primary_set) {
    $grants[] = array(
      'realm' => 'domain_id',
      'gid' => 0,
      'grant_view' => TRUE,
      'grant_update' => TRUE,
      'grant_delete' => TRUE,
      'priority' => 0,
    );
  }
}

installed it without an error but this module is not working.

If this code is not complete, would you help us to completed this module so we could use it as a quick solution ?
Thank in advance, and i very appreciate for your help.
Apologize if this request excessive.

agentrickard’s picture

The problem is that hook_domainrecords() was put into D7 core as hook_node_access_records_alter().

Try modifying your code to use the new hook. Note that you must then save the changes to the {domain_access} table. See domain.API.php or domain_node_access_records() for examples.

anjjriit’s picture


function domain_custom_affiliate_node_access_records_alter(&$grants, $node) {
  global $_domain;
  // We only care about the book node.
  if ($node->type != 'book') {
    return;
  }
  $primary_set = FALSE;
  foreach ($grants as $key => $grant) {
    // Remove the domain_site grant.
    if ($grant['realm'] == 'domain_site') {
      unset($grants[$key]);
    }
    // Remove domains we don't want.
    else if ($grant['gid'] != $_domain['domain_id']) {
      unset($grants[$key]);
    }
    // Check that the primary domain is set.
    if ($grant['gid'] == 0 && $grant['realm'] == 'domain_id') {
      $primary_set = TRUE;
    }
  }
  // Make sure the primary domain is selected.
  if (!$primary_set) {
    $grants[] = array(
      'realm' => 'domain_id',
      'gid' => 0,
      'grant_view' => TRUE,
      'grant_update' => TRUE,
      'grant_delete' => TRUE,
      'priority' => 0,
    );
  }
  // Store our records in the {domain_access} table.
  _domain_store_grants($node->nid, $grants);
}

This is my latest modification.
saved book node from sub domain is still do not automatically publish to main domain.
Please, i need any advice.

agentrickard’s picture

Domain id with gid of zero is incorrect in 7.x.3. Use domain_default_id().

anjjriit’s picture

Thanks a lot for your advice !!!
This is my latest code, i can automatic publish book page from subdomain and automatically publish it to main domain.


function domain_custom_affiliate_node_access_records_alter(&$grants, $node) {
  global $_domain;
  // We only care about the book node.
  if ($node->type != 'book') {
    return;
  }
  $primary_set = FALSE;
  foreach ($grants as $key => $grant) {
    // Remove the domain_site grant.
    if ($grant['realm'] == 'domain_site') {
      unset($grants[$key]);
    }
    // Remove domains we don't want.
    else if ($grant['gid'] != $_domain['domain_id']) {
      unset($grants[$key]);
    }
    // Check that the primary domain is set.
    if ($grant['gid'] == 0 && $grant['realm'] == 'domain_id')  {
      $primary_set = TRUE;
    }
  }
  // Make sure the primary domain is selected.
  if (!$primary_set) {
	// Always publish all content to the primary domain.
	$grants[] = array(
		'realm' => 'domain_id',
		'gid' => domain_default_id(),
		'grant_view' => $node->status,
		'grant_update' => 1,
		'grant_delete' => 1,
		'priority' => 0,
	);
  }
  // Store our records in the {domain_access} table.
  _domain_store_grants($node->nid, $grants);
}

is it will be an additional feature for domain access ?

agentrickard’s picture

I think if we can work out the UI (as mentioned in 2 and 3 above), then it's a good feature.

agentrickard’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)