Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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;
}
}
Comment | File | Size | Author |
---|---|---|---|
#2 | quiz-2850330-1.patch | 811 bytes | Da_Cloud |
|
Comments
Comment #2
Da_Cloud CreditAttribution: Da_Cloud at INDICIA commentedComment #3
krina.addweb CreditAttribution: krina.addweb at AddWeb Solution Pvt. Ltd. commented@Da_Cloud, Thanks for the patch correction it works well.
Comment #5
djdevinThanks. Fixed!
Comment #6
krina.addweb CreditAttribution: krina.addweb at AddWeb Solution Pvt. Ltd. commentedHi djdevin,
I guess you forgot to provide me RTBC credit, can you please do the needful.