Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Duplicate
-
2.2.5
-
None
-
None
-
MOODLE_22_STABLE
Description
Wiki settings:
- mode: collaborative
- force format: checked
- group mode: Separate groups | Visible groups
The instructor has created the first page of the wiki (so a wiki_subwiki record is created with groupid=0 and userid=0 for the wiki).
Students will see "You can not view/edit this page"
The cause:
mod/wiki/create.php calls $wikipage->create_page() in two situations:
#1. User submitted a form where they selected the format
#2. Force-format is checked
The function page_wiki_create::create_page() has been modified recently (commit 595b68e2fdb22351972 for MDL-30478). It now ignores $this->gid used to be in there (set by create.php in situation #2), and only consider the $data->groupinfo from form-submission (situation #1). Thus, when force-format is checked (#2), the $groupid becomes '0', the instructor's subwiki record is retrieved instead (groupid=0). This record will prevent the student from editing (as groupid 0 won't match the student's groupid)
So, the code can be modified from:
================
if (isset($data->groupinfo)) {
$groupid = $data->groupinfo;
} else {
$groupid = '0';
}
===============
to something like this (verified that it fixes the problem on my end):
================
if (isset($data->groupinfo)) {
$groupid = $data->groupinfo;
} else if (!empty($this->gid)) {
$groupid = $this->gid;
} else {
$groupid = '0';
}
===============
I'm not sure if this would affect/break anything else.
Attachments
Issue Links
- duplicates
-
MDL-35653 Wiki module does not work if you activate the force format option
-
- Closed
-