You are here

function og_quiz_node_prepare in OG Quiz 7

Implements hook_node_prepare().

File

./og_quiz.module, line 23
Module hooks and custom logic.

Code

function og_quiz_node_prepare($node) {
  $question_types = array_keys(_quiz_question_get_implementations());
  $type = is_string($node) ? $node : $node->type;
  if (in_array($type, $question_types)) {
    if (isset($_GET['quiz_nid'])) {
      $quiz = node_load($_GET['quiz_nid'], isset($_GET['quiz_vid']) ? $_GET['quiz_vid'] : NULL);
      if (!empty($quiz->og_group_ref)) {
        $node->og_group_ref = $quiz->og_group_ref;
      }
    }
  }
}