I installed the latest stable of nodehierarchy, created some nodes and everything worked great. But after installing nodeaccess (latest stable too) and configuring it, i get this warning:

user warning: Unknown column 'n.nid' in 'on clause' query: SELECT * FROM d_node n, d_nodehierarchy h INNER JOIN d_node_access na ON na.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 2 AND na.realm = 'nodeaccess_rid') OR (na.gid = 4 AND na.realm = 'nodeaccess_rid') OR (na.gid = 7 AND na.realm = 'nodeaccess_uid') OR (na.gid = 7 AND na.realm = 'nodeaccess_author'))) AND ( h.nid = n.nid AND h.parent = 0 AND n.type IN ('locatie') )ORDER BY h.order_by ASC in /var/www/mysite/sites/all/modules/nodehierarchy/nodehierarchy.module on line 985.

Thanks for this great module.

Comments

andreiashu’s picture

The error appears only when i edit a node. Another thing to note is that the node in question is a child of another node. If i go to it's parent I can edit it without the warning appearing.
Sorry for the misleading.

Edit: the permissions are working correctly though. the users/roles that must see that node can access it and the ones that mustn't receive an access denied.

andreiashu’s picture

Status: Active » Postponed (maintainer needs more info)

I modified the query in _nodehierarchy_get_parent_pulldown_items function from:

$query = "SELECT * FROM {node} n, {nodehierarchy} h WHERE h.nid = n.nid AND h.parent = %d AND n.type IN (". implode( ",", $types ) .") ORDER BY h.order_by ASC";

to

$query = "SELECT * FROM {node} n INNER JOIN {nodehierarchy} h ON h.nid = n.nid WHERE h.nid = n.nid AND h.parent = %d AND n.type IN (". implode( ",", $types ) .") ORDER BY h.order_by ASC";

and the warning disappeared. Everything seems to be working just fine: the parent nodes appear in the "Node Hierarchy" fieldset.
The computed query looks like this now (copied from devel output):

SELECT * FROM d_node n INNER JOIN d_nodehierarchy h ON h.nid = n.nid INNER JOIN d_node_access na ON na.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 2 AND na.realm = 'nodeaccess_rid') OR (na.gid = 4 AND na.realm = 'nodeaccess_rid') OR (na.gid = 7 AND na.realm = 'nodeaccess_uid') OR (na.gid = 7 AND na.realm = 'nodeaccess_author'))) AND ( h.nid = n.nid AND h.parent = 0 AND n.type IN ('locatie') )ORDER BY h.order_by ASC

I really need some feedback with this issue because my experience with Node Hierarchy and Node Access is absolutely 0.
Thanks in advance.

ronan’s picture

Status: Postponed (maintainer needs more info) » Fixed

That is the right fix alright. This is done in the latest dev and I'll be making a stable release with that code soon.

More info can be found at #334962: User warning when creating a child node and #341846: Conflict between Node Hierarchy and Killfile is causing SQL error when adding a new node or visiting NH configuration page

Thanks
Ronan

andreiashu’s picture

nice, thanks a lot.

Status: Fixed » Closed (fixed)
Issue tags: -nodeaccess

Automatically closed -- issue fixed for 2 weeks with no activity.