Hi all, I am working on a small hack and need some advice.
Here is my task:
When a new student enrolls, I want to simulate an attempt on the one quiz the course offers.
The variable that holds the value of the time of the last quiz attempt is this:
$attempt->timefinish
I don't think I can just place a time into this variable.
In the file, /mod/quiz/attempt.php, I have found the following code which I believe records a new attempt to the student's log when the quiz is completed:
if ($attempt = quiz_save_attempt($quiz, $questions, $result, $attemptnumber)) {
add_to_log($course->id, "quiz", "submit", "review.php?id=$cm->id&attempt=$attempt->id", "$quiz->id", $cm->id);
For user enrollment I am using the paypal plugin. For this setup, I believe I will need to add the correct function call to the statement block at line 26 of the file:
/enrol/paypal/return.php
Any help is indeed appreciated. I am familiar with various languages, although I am unfamiliar with php's structure. Tips such as whether or not I would be allowed to make such a function call from outside of the quiz folder, or how I could discover how to recreate such a function call are appreciated.
Thanks!
General developer forum
Need help for how to simulate a quiz attempt
This discussion has been locked so you can no longer reply to it.