Active
Project:
Node Hierarchy
Version:
7.x-2.x-dev
Component:
Drupal/PHP Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 May 2011 at 11:55 UTC
Updated:
13 Sep 2012 at 17:05 UTC
Jump to comment: Most recent file
Comments
Comment #1
alexbern commentedand 2nd:
Notice: Undefined property: stdClass::$nid in nodehierarchy_nodehierarchy_node_form() (line 543 of C:\xampp\htdocs\drupal-dev\sites\all\modules\nodehierarchy\nodehierarchy.module).
when trying to create a new node.
Comment #2
xcono commentedsubcribe
Comment #3
keithm commentedPatch attached for the first issue. I can't reproduce the problem in #1. Could you please provide steps to reproduce it?
Comment #4
keithm commentedFound the second one. This patch fixes both warnings.
Comment #5
alexbern commentedThanks a lot. will give it a try in combination with mulitple parents patch.
Comment #6
jvandooren commentedThis patch did the trick for me. It also fixed this issue: #1137766: Error on saving new content
Comment #7
ecksley commentedI get the following error when creating nodes as a user who does not have any permissions pertaining to Node Hierarchy.
Notice: Undefined property: stdClass::$nid in nodehierarchy_nodehierarchy_node_form() (line 521 of /path/to/drupal/sites/all/modules/nodehierarchy/nodehierarchy.module).
However when working as a the superuser I have no such issue.
I tried the patch from #4 and it made no difference.
Thanks for you help and the cool module.
Comment #8
modoq commentedWhen creating a new child node I get the 2nd error, but on line 521! So the patch #4 won't work.
Notice: Undefined property: stdClass::$nid in nodehierarchy_nodehierarchy_node_form() (line 521 of /var/www/sites/all/modules/nodehierarchy/nodehierarchy.module).
Comment #9
BenPoole commentedI can not get either patch to run correctly. I get the following errors when running either patch:
bash: warnings-produced-when-creating-nodes-1168348-4.patch: line 5: syntax error near unexpected token `('
bash: warnings-produced-when-creating-nodes-1168348-4.patch: line 5: `@@ -540,7 +540,7 @@ function nodehierarchy_nodehierarchy_node_form($node) {'
Comment #10
doom_fist commentedI've applied the patch in #4, but I continue to see the error upon creation of a new node.
Error message
Notice: Undefined property: stdClass::$nodehierarchy_menu_links in _nodehierarchy_save_node() (line 714.../sites/all/modules/nodehierarchy/nodehierarchy.module).
Comment #11
jnettikI was getting the error in #1 and used patch in #4. Seems to work so far.Edit: After some more testing I'm getting the same error in #10.
Comment #12
tevans commentedsubscribing
Comment #13
taecelle commentedI deleted in line 521:
$node->nid == NULL && user_access('create child nodes') etc.
following part:
->nid
And this worked!!!
Comment #14
bigpapa commentedI get this error when creating new content:
PDOException: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near the keyword 'IF'.: 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 ('department', 'page') 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; Array ( ) in _nodehierarchy_parent_options() (line 1607 of \Drupal\sites\all\modules\nodehierarchy\nodehierarchy.module).
Comment #15
luco commenteduhm. just so I'm clear, do these error messages imply any actual error that might cause data loss?
Comment #16
liam morland@#15 The error in #14 looks like one that would just cause the SELECT to fail and would not cause data loss. It looks like the query needs to be rewritten to replace the IF with COALESCE to give it wider database compatibility.
Comment #17
Courtney.B commentedRan patch #4, error's gone now.
Comment #18
luco commentedsame here. ran the patch and now it works. :] thanks!
Comment #19
Bartox commentedPatch applied, the warnings are gone now.
Comment #20
ronan commentedNot really sure how to produce these warnings but the patch doesn't seem to cause any issues so I've committed it. Thanks all.
Comment #22
luco commented@doom_fist make sure the permissions create child nodes, edit all node parents and edit own node parents are on. that worked for me.
cheers
Comment #23
ryanrain commentedhi all,
i'm not sure if this is the same issue, or separate, so i apologize if i've made a mistake in reopening it. the module works great for the super admin user, problems appear for anonymous:
I'm still getting the error
Undefined property: stdClass::$nid in nodehierarchy_nodehierarchy_node_form() (line 533on the top of a child node add form, and then the relationship is not saved, and the token [node:nodehierarchy:parent:title] is not generated.steps to reproduce:
1. give permissions to anonymous users: Node: Create new child_node_type; Node Hierarchy: create child nodes, and, for good measure as @luco says above, edit all node parents and edit own node parents. as a side note from a site builder ui perspective, i don't think these should be necessary.
2. as an anonymous user, go to the parent page. although permissions are given, the default Create new child child_node_type does not appear. i have a view with a hardcoded link that passes the parent node id argument, i click that. to save time you could probably just type in the ?destination=node/27&parent=27 url.
3. error appears. node is saved normally, but without node hierarchy relationship data.
sorry to post this without trying to troubleshoot the php. one day i'll get time to dive in and learn it.
thanks in advance,
-ryan
Comment #24
ishiomin commentedI had the same error but with an authenticated user.
This correction solve the problem :
- ($node->nid == NULL && user_access('create child nodes')) ||
+ (!isset($node->nid) && user_access('create child nodes')) ||
I attach the patch.
May be you already do the correction, it's a very useful module.
Guy