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

joel_osc’s picture

After 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.

falcon’s picture

Status: Active » Fixed

Thanks for reporting

Status: Fixed » Closed (fixed)

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

  • Commit 470e4c4 on 7.x-4.x, 7.x-5.x by falcon:
    Fixed #1519744 reported by joel_liquidcms: Exception when adding...

  • Commit 470e4c4 on 7.x-4.x, 7.x-5.x, quiz-pages by falcon:
    Fixed #1519744 reported by joel_liquidcms: Exception when adding...

  • Commit 470e4c4 on 7.x-4.x, 7.x-5.x, quiz-pages, 2269219 by falcon:
    Fixed #1519744 reported by joel_liquidcms: Exception when adding...

  • Commit 470e4c4 on 7.x-4.x, 7.x-5.x, 2269219 by falcon:
    Fixed #1519744 reported by joel_liquidcms: Exception when adding...