mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
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; merged from MOODLE_17_STABLE
This commit is contained in:
parent
ea3caf69cd
commit
7b678e0a99
@ -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;
|
||||
|
@ -111,6 +111,13 @@ function xmldb_main_upgrade($oldversion=0) {
|
||||
$result = $result && add_field($table, $field);
|
||||
}
|
||||
|
||||
if ($oldversion < 2006120300) { /// Delete guest course section settings
|
||||
// following code can be executed repeatedly, such as when upgrading from 1.7.x - it is ok
|
||||
if ($guest = get_record('user', 'username', 'guest')) {
|
||||
execute_sql("DELETE FROM {$CFG->prefix}course_display where userid=$guest->id ;", true);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
@ -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 = 2006112200; // YYYYMMDD = date
|
||||
$version = 2006120300; // YYYYMMDD = date
|
||||
// XY = increments within a single day
|
||||
|
||||
$release = '1.8 dev'; // Human-friendly version name
|
||||
|
Loading…
x
Reference in New Issue
Block a user