Closed (fixed)
Project:
Domain
Version:
5.x-1.8
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
3 Oct 2008 at 01:49 UTC
Updated:
11 Oct 2008 at 15:21 UTC
I'm modifying the FeedAPI Inherit module to add http://drupal.org/node/233281 (Make feed item Inherit Domain Access info from feed). Everything else works, there's just one thing left to do - given two $node objects, what PHP code do I need to copy the Domain Access settings (i.e. which domains they're assigned to, and whether it's published to all affiliates) from the parent node to the other node? It seems this should be simple, but I'm struggling to find out how to do it. Thanks!
Comments
Comment #1
agentrickardIn the parent node object, there should be two elements:
$node->domain_site == BOOLEAN TRUE/FALSE
$node->domain == array() of active domains
The only trick is that $node->domain may have an element of -1, which is the default domain. We have to use -1 because FormsAPI checkboxes do not allow for a 0 to be passed as a value. So sometimes we have to convert the -1 to 0. You should not have to here.
See
domain_node_access_records()to see how these values are handled. In that function, you can ignore the $node->domains_raw variable, which is only used for non-privileged users.So you probably need something like this:
That should be about it. node_save() will invoke the node access rules for you.
Comment #2
agentrickardComment #3
Jomel commentedThis works great, thanks. I'll submit a patch for FeedAPI Inherit soon...