MDL-7767 Guests should not be able to hide course sections - section hiding is not stored in db for guests, only session is used now
This commit is contained in:
+3
-5
@@ -1027,15 +1027,13 @@ function get_all_sections($courseid) {
|
||||
function course_set_display($courseid, $display=0) {
|
||||
global $USER;
|
||||
|
||||
if (empty($USER->id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($display == "all" or empty($display)) {
|
||||
$display = 0;
|
||||
}
|
||||
|
||||
if (record_exists("course_display", "userid", $USER->id, "course", $courseid)) {
|
||||
if (empty($USER->id) or $USER->username == 'guest') {
|
||||
//do not store settings in db for guests
|
||||
} else if (record_exists("course_display", "userid", $USER->id, "course", $courseid)) {
|
||||
set_field("course_display", "display", $display, "userid", $USER->id, "course", $courseid);
|
||||
} else {
|
||||
$record->userid = $USER->id;
|
||||
|
||||
@@ -56,6 +56,12 @@ function xmldb_main_upgrade($oldversion=0) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($oldversion < 2006101008) { /// Delete guest course section settings
|
||||
if ($guest = get_record('user', 'username', 'guest')) {
|
||||
execute_sql("DELETE FROM {$CFG->prefix}course_display where userid=$guest->id ;", true);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
// This is compared against the values stored in the database to determine
|
||||
// whether upgrades should be performed (see lib/db/*.php)
|
||||
|
||||
$version = 2006101007; // YYYYMMDD = date of the 1.7 branch (don't change)
|
||||
$version = 2006101008; // YYYYMMDD = date of the 1.7 branch (don't change)
|
||||
// X = release number 1.7.[0,1,2,3...]
|
||||
// Y = micro-increments between releases
|
||||
|
||||
|
||||
Reference in New Issue
Block a user