Index: nodehierarchy.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/nodehierarchy/nodehierarchy.module,v
retrieving revision 1.12.2.17
diff -u -p -r1.12.2.17 nodehierarchy.module
--- nodehierarchy.module	12 Aug 2010 20:48:00 -0000	1.12.2.17
+++ nodehierarchy.module	24 Aug 2010 18:35:43 -0000
@@ -1488,17 +1488,26 @@ function _nodehierarchy_parent_options($
   // Get the items with menu links.
   $items = $mlids = array();
   if ($types) {
+    // Add domain support
+    if (module_exists('domain')){
+      global $_domain;
+      $domain = array();
+      $domain['join'] = "LEFT JOIN {domain_access} da ON da.nid = n.nid";
+      $domain['where'] = "da.gid = '" . $_domain['domain_id'] . "' AND ";
+    }
     $result = db_query(
-                        "SELECT n.nid, n.type as type, n.title as title, n.uid as uid, ml.*, IF(depth IS NULL, 1, depth) as depth, IF(ml.mlid IS NULL, CONCAT('nid:', n.nid), ml.mlid) as mlid, ml.mlid as linkid
-                           FROM {node} n
-                      LEFT JOIN {nodehierarchy_menu_links} nh_parent
-                             ON nh_parent.nid = n.nid
-                      LEFT JOIN {menu_links} ml
-                             ON ml.mlid = nh_parent.mlid
-                          WHERE (ml.module = 'nodehierarchy' OR ml.module IS NULL)
-                            AND n.type IN (". implode(', ', $types) .")
-                          ORDER BY IF(p1 IS NULL, n.created, 0) ASC, p1 ASC, p2 ASC, p3 ASC, p4 ASC, p5 ASC, p6 ASC, p7 ASC, p8 ASC, p9 ASC"
-                    );
+        "SELECT n.nid, n.type as type, n.title as title, n.uid as uid, ml.*,
+                IF(depth IS NULL, 1, depth) as depth, IF(ml.mlid IS NULL, CONCAT('nid:', n.nid), ml.mlid) as mlid, ml.mlid as linkid
+           FROM {node} n
+      LEFT JOIN {nodehierarchy_menu_links} nh_parent
+             ON nh_parent.nid = n.nid
+      LEFT JOIN {menu_links} ml
+             ON ml.mlid = nh_parent.mlid
+      " . ($domain ? $domain['join'] : '') . "
+          WHERE " . ($domain ? $domain['where'] : '') . "(ml.module = 'nodehierarchy' OR ml.module IS NULL)
+            AND n.type IN (". implode(', ', $types) .")
+          ORDER BY IF(p1 IS NULL, n.created, 0) ASC, p1 ASC, p2 ASC, p3 ASC, p4 ASC, p5 ASC, p6 ASC, p7 ASC, p8 ASC, p9 ASC"
+    );
   }
 
   // Flatten tree to a list of options.
