How to find a node based on the domain?
rich.yumul - November 8, 2009 - 21:24
| Project: | Domain Access |
| Version: | 6.x-2.0-rc9 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I'd like to be able to load a node based on its' type and the domain to which it belongs.
Now, finding a node based on type is pretty straight forward; I just do a :
$node = node_load(array('type' => 'story'));
This doesn't work:
$node = node_load(array('type' => 'story', 'domains' => array('2' => '2'));
I couldn't figure out a programatic way to find a node that is a particular type and that belongs to a particular domain. Instead, I'm just doing it manually thru SQL, joining the node and domain_access table.
Is there a 'recommended' way to programatically get a node that belongs to a particular domain?
TIA

#1
Other than using Views, no. Core node_load() does not allow JOINs to other tables.
Doing a join to {domain_access} should be fine (and properly indexed).