Hi everybody,
I found a bug in noderelationship : appear when we want to add a node in a "Node reference CCK field" in certains conditions.
Iit's a similar issue as http://drupal.org/node/943564
I have two contents types (CT1 and a CT2) that can be referenced in a CCK field (via node reference) in a CT3.
A "user A" can create both CT1 and CT2.
A "user B" can only create CT1 or can only create CT2.
For "user B", that result by a drupal_not_found() in the noderelationships_noderef_page() function.
For "user A" => no problem.
This happens due to noderelationships_noderef_page_create(), at lmine 398
if (count($node_add_list) > 1) {
return theme('node_add_list', $node_add_list);
}
is this case ("user B"), count($node_add_list) = 1.
After this code, there is a drupal_goto(), but it isn't called (use to go to the node add page)
This is due to the $new_type that isn't defined properly (due of foreach() before)
I Modified the code like that
if (count($node_add_list) > 1) {
return theme('node_add_list', $node_add_list);
}
// There is only one content type we can create
else {
// Redefine $new_type, cause of foreach ..
$merge = array_intersect($reference_fields[$field_name], $creatable_types);
if (count($merge) == 1)
$new_type = $merge[0];
else
return theme('node_add_list', $node_add_list);
}
}
Sorry for my poor english, hope this can help someone !
Maxime
Comment | File | Size | Author |
---|---|---|---|
noderelationships.pages_.inc_.patch | 1.09 KB | T2k |
Comments
Comment #1
T2k CreditAttribution: T2k commented