Closed (duplicate)
Project:
Content Construction Kit (CCK)
Version:
5.x-1.x-dev
Component:
nodereference.module
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
9 Dec 2010 at 17:28 UTC
Updated:
29 Dec 2010 at 21:10 UTC
I have recently used node reference on a Drupal 5 install. And the problem occurs when you are not logged in, in the function: nodereference_field_formatter in nodereference.module line: 188
if (!isset($titles[$item['nid']])) {
if ($title = db_result(db_query(db_rewrite_sql("SELECT title FROM {node} WHERE nid=%d"), $item['nid']))) {
$titles[$item['nid']] = $title ? $title : '';
}
}
During the rewrite, it adds node_access joins, wich will result in MySQL returning "ambiguous nid in your query.".
Replace the above code with:
if (!isset($titles[$item['nid']])) {
if ($title = db_result(db_query(db_rewrite_sql("SELECT title FROM {node} n WHERE n.nid=%d"), $item['nid']))) {
$titles[$item['nid']] = $title ? $title : '';
}
}
I hope this gets ported in new releases.
Gabriel
Comments
Comment #1
longwaveDuplicate of #831056: nodereference_field_formatter: throws sql error