I am using Drupal 6 and Domain Access-6.x-2.11. I need to programmatically add nodes to subdomains defined in Domain Access configuration. I've been looking the source code of domain.module but can't figure out how to use the api of the module to add a node to certain subdomains.

Any suggestions?


Since I didnt find a way to do this with api I solved this by editing the table where domain access keeps the info about which node belongs to which domain.


Answer for Drupal 7:

$node->domains = $domains;
$node->domain_site = FALSE;
$node->domain_source = '1';

Where $domains is an associative array like that:

$domains = array(
 '1' => '1',
 '4' => '4',

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.