This is a really fantastic module! I am currently seeing an issue where if I add a question it shows up fine in the browse to add questions area, but if I select the checkbox and hit submit I get a whitescreen with the following error:
Exception: Query tagged for node access but there is no nid. Add foreign keys to node.nid in schema to fix. in _node_query_node_access_alter() (line 3216 of /var/www/lms/modules/node/node.module).
The problem only happens while logged in as a non-administrator user.
Comments
Comment #1
joel_osc commentedAfter some investigation the error is produced when lines 1436-1442 are executed:
$question_types = array_keys(_quiz_get_question_types());
//$placeholders = db_placeholders($question_types, 'text');
//$sql = 'SELECT COUNT(nid) FROM {node} WHERE type IN (' . $placeholders . ') AND nid = %d';
$questions_count = db_select('node', 'n')
->condition('type', array_keys(_quiz_get_question_types()), 'IN')
->countQuery()
->addTag('node_access')
->execute()
->fetchField();
I know this is not the solution, but commenting out the addTag('node_access') makes the problem go away. I am unsure how node_acess works - I believe it invokes the sites node_access modules to rewrite the SQL appropriately which in this case is not working. I am not using any fancy node_access modules - just the core. I have all permissions opened up (edit any *) for quiz and all quiz questions for this users role.
Comment #2
falcon commentedThanks for reporting