Inside the quiz_question.core.inc you can find the following function below, together with an @todo to remove the node context.

Looking at the code we still do the node_load(arg(1)), which the todo is talking about. However the variable isn't really used inside the function.

/**
   * Determines if the user can view the correct answers
   *
   * @todo grabbing the node context here probably isn't a great idea
   *
   * @return TRUE|NULL
   *   TRUE if the view may include the correct answers to the question
   */
  public function viewCanRevealCorrect() {
    global $user;
    $quiz_node = node_load(arg(1));

    $reveal_correct[] = user_access('view any quiz question correct response');
    $reveal_correct[] = ($user->uid == $this->node->uid);
    if (array_filter($reveal_correct)) {
      return TRUE;
    }
  }
CommentFileSizeAuthor
#2 quiz-2850330-1.patch811 bytesDa_Cloud
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Da_Cloud created an issue. See original summary.

Da_Cloud’s picture

Status: Active » Needs review
FileSize
811 bytes
krina.addweb’s picture

Status: Needs review » Reviewed & tested by the community

@Da_Cloud, Thanks for the patch correction it works well.

  • djdevin committed 1929479 on 7.x-5.x authored by Da_Cloud
    Issue #2850330 by Da_Cloud: Remove node context from quiz_question::...
djdevin’s picture

Status: Reviewed & tested by the community » Fixed

Thanks. Fixed!

krina.addweb’s picture

Hi djdevin,

I guess you forgot to provide me RTBC credit, can you please do the needful.

Status: Fixed » Closed (fixed)

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