function quiz_delete in Quiz 7
Same name and namespace in other branches
- 5.2 quiz.module \quiz_delete()
- 5 quiz.module \quiz_delete()
- 6.6 quiz.module \quiz_delete()
- 6.2 quiz.module \quiz_delete()
- 6.3 quiz.module \quiz_delete()
- 6.4 quiz.module \quiz_delete()
- 6.5 quiz.module \quiz_delete()
- 7.6 quiz.module \quiz_delete()
- 7.4 quiz.module \quiz_delete()
- 7.5 quiz.module \quiz_delete()
Implements hook_delete().
File
- ./
quiz.module, line 789 - Quiz Module
Code
function quiz_delete($node) {
$res = db_query('SELECT result_id FROM {quiz_node_results}
WHERE nid = :nid', array(
':nid' => $node->nid,
));
$rids = array();
while ($rid = $res
->fetchField()) {
$rids[] = $rid;
}
quiz_delete_results($rids);
// Remove quiz node records from table quiz_node_properties
db_delete('quiz_node_properties')
->condition('nid', $node->nid)
->execute();
// Remove quiz node records from table quiz_node_relationship
db_delete('quiz_node_relationship')
->condition('parent_nid', $node->nid)
->execute();
// Remove quiz node records from table quiz_node_results
db_delete('quiz_node_results')
->condition('nid', $node->nid)
->execute();
// Remove quiz node records from table quiz_node_result_options
db_delete('quiz_node_result_options')
->condition('nid', $node->vid)
->execute();
}