Skip to content

Commit afdf21b

Browse files
committed
mod_form: only check $recordingsettings if it might be set
1 parent 6972df1 commit afdf21b

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

mod_form.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -652,27 +652,27 @@ public function definition() {
652652
// Add autorecording option if enabled.
653653
$allowrecordingchangeoption = $config->allowrecordingchangeoption;
654654
if ($allowrecordingchangeoption) {
655+
$defaultsetting = $config->recordingoption;
656+
655657
// Add auto recording options according to user settings.
656658
$options = [
657659
ZOOM_AUTORECORDING_NONE => get_string('autorecording_none', 'mod_zoom'),
658660
];
659661

660662
if (!empty($hostuserid)) {
661663
$recordingsettings = zoom_get_user_settings($hostuserid)->recording;
662-
}
663664

664-
if (!empty($recordingsettings->local_recording)) {
665-
$options[ZOOM_AUTORECORDING_LOCAL] = get_string('autorecording_local', 'mod_zoom');
666-
}
665+
if ($config->recordingoption === ZOOM_AUTORECORDING_USERDEFAULT) {
666+
$defaultsetting = $recordingsettings->auto_recording;
667+
}
667668

668-
if (!empty($recordingsettings->cloud_recording)) {
669-
$options[ZOOM_AUTORECORDING_CLOUD] = get_string('autorecording_cloud', 'mod_zoom');
670-
}
669+
if (!empty($recordingsettings->local_recording)) {
670+
$options[ZOOM_AUTORECORDING_LOCAL] = get_string('autorecording_local', 'mod_zoom');
671+
}
671672

672-
if ($config->recordingoption === ZOOM_AUTORECORDING_USERDEFAULT) {
673-
$defaultsetting = $recordingsettings->auto_recording;
674-
} else {
675-
$defaultsetting = $config->recordingoption;
673+
if (!empty($recordingsettings->cloud_recording)) {
674+
$options[ZOOM_AUTORECORDING_CLOUD] = get_string('autorecording_cloud', 'mod_zoom');
675+
}
676676
}
677677

678678
$mform->addElement('select', 'option_auto_recording', get_string('option_auto_recording', 'mod_zoom'), $options);
@@ -875,14 +875,14 @@ public function definition_after_data() {
875875

876876
if ($zoomuserid !== false) {
877877
$recordingsettings = zoom_get_user_settings($zoomuserid)->recording;
878-
}
879878

880-
if (!empty($recordingsettings->local_recording)) {
881-
$options[ZOOM_AUTORECORDING_LOCAL] = get_string('autorecording_local', 'mod_zoom');
882-
}
879+
if (!empty($recordingsettings->local_recording)) {
880+
$options[ZOOM_AUTORECORDING_LOCAL] = get_string('autorecording_local', 'mod_zoom');
881+
}
883882

884-
if (!empty($recordingsettings->cloud_recording)) {
885-
$options[ZOOM_AUTORECORDING_CLOUD] = get_string('autorecording_cloud', 'mod_zoom');
883+
if (!empty($recordingsettings->cloud_recording)) {
884+
$options[ZOOM_AUTORECORDING_CLOUD] = get_string('autorecording_cloud', 'mod_zoom');
885+
}
886886
}
887887

888888
$recordingelement->load($options);

0 commit comments

Comments
 (0)