function answers_node_delete in Answers 7.3
Same name and namespace in other branches
- 7.4 answers.module \answers_node_delete()
- 7 answers.module \answers_node_delete()
- 7.2 answers.module \answers_node_delete()
Implements hook_node_delete().
File
- ./
answers.module, line 193
Code
function answers_node_delete($node) {
if ($node->type == 'question') {
$answer_nids = _answers_question_answers($node);
foreach ($answer_nids as $answer_nid) {
// To be able to delete the answer nodes, first unset their reference to
// the question. Otherwise a warning results.
$answer = node_load($answer_nid);
$answer->field_answer_question = array();
node_save($answer);
node_delete($answer_nid);
}
}
}