diff --git a/classes/structure.php b/classes/structure.php index d7953b8..b341f94 100644 --- a/classes/structure.php +++ b/classes/structure.php @@ -395,6 +395,7 @@ class mod_attendance_structure { $sess->lasttaken = 0; $sess->lasttakenby = 0; $sess->studentscanmark = 0; + $sess->studentpassword = ''; $event->add_record_snapshot('attendance_sessions', $sess); $event->trigger(); diff --git a/sessions.php b/sessions.php index e527c59..40b9e9e 100644 --- a/sessions.php +++ b/sessions.php @@ -294,11 +294,11 @@ function construct_sessions_data_for_add($formdata) { $sess->description = $formdata->sdescription['text']; $sess->descriptionformat = $formdata->sdescription['format']; $sess->timemodified = $now; - if (isset($formdata->studentscanmark)) { // Students will be able to mark their own attendance. + $sess->studentscanmark = 0; + $sess->studentpassword = ''; + if (isset($formdata->studentscanmark) && !empty($formdata->studentscanmark)) { // Students will be able to mark their own attendance. $sess->studentscanmark = 1; $sess->studentpassword = $formdata->studentpassword; - } else { - $sess->studentpassword = ''; } $sess->statusset = $formdata->statusset;