Details
Description
- Set up a valid email for the Moodle instance in Site administration ► Plugins ► Message outputs ► Email
- Set the Debug messages to DEVELOPER in "Site administration ► Development ► Debugging"
- Create a course. Enrol students and teachers. Make sure the enrolled teachers have valid email addresses.
- Create a quiz.
- Under "Quiz administration", click "Permissions".
- Select the "Teacher" role for the "Advanced role override" dropdown menu
- Set the capability "mod/quiz:emailnotifysubmission" to "Allow" then click "Save changes".
- Attempt the quiz as a student.
- After submitting the quiz, the following debug messages will be shown:
Necessary properties missing in userto object, fetching full record
line 95 of /lib/messagelib.php: call to debugging()
line 1451 of /mod/quiz/locallib.php: call to message_send()
line 1531 of /mod/quiz/locallib.php: call to quiz_send_notification()
line 1644 of /mod/quiz/locallib.php: call to quiz_send_notification_messages()
line ? of unknownfile: call to quiz_attempt_submitted_handler()
line 155 of /lib/classes/event/manager.php: call to call_user_func()
line 89 of /lib/classes/event/manager.php: call to core\event\manager::process_buffers()
line 2411 of /lib/dml/moodle_database.php: call to core\event\manager::database_transaction_commited()
line 92 of /lib/dml/moodle_transaction.php: call to moodle_database->commit_delegated_transaction()
line 184 of /mod/quiz/processattempt.php: call to moodle_transaction->allow_commit()
Upon investigation, the debug messages are being shown because the $eventdata->userto object that is being passed into the message_send function of lib/messagelib.php from the $recipient parameter in quiz_send_notification function of mod/quiz/locallib.php does not have the auth, suspended, deleted and emailstop properties.
These properties should be included in the $notifyfields variable of the quiz_send_notification_messages on line 1551 of mod/quiz/locallib.php.