Skip to content

Commit

Permalink
Bugfix: Use correct context and test on $settings-id, not optionid
Browse files Browse the repository at this point in the history
  • Loading branch information
georgmaisser committed Dec 20, 2024
1 parent 872824f commit 91fdffa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions optionview.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@
$returnurl = optional_param('returnurl', '', PARAM_URL);

$modcontext = context_module::instance($cmid);
$syscontext = context_system::instance();

// If we have this setting.
if (!get_config('booking', 'bookonlyondetailspage')) {
require_capability('mod/booking:view', $modcontext);
}

$PAGE->set_context($modcontext);
$PAGE->set_context($syscontext);

$url = new moodle_url('/mod/booking/optionview.php', ['cmid' => $cmid, 'optionid' => $optionid]);
$PAGE->set_url($url);
Expand All @@ -69,7 +70,7 @@
}

$settings = singleton_service::get_instance_of_booking_option_settings($optionid);
if ($settings && !empty($settings->optionid)) {
if ($settings && !empty($settings->id)) {
if ($userid == $USER->id || $userid == 0) {
$user = $USER;
} else {
Expand Down

0 comments on commit 91fdffa

Please sign in to comment.