Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-36313

Student cannot create Wiki if force-format is ON (in separate/visible group mode)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.2.5
    • Fix Version/s: None
    • Component/s: Wiki (2.x)
    • Labels:
      None
    • Affected Branches:
      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

            Activity

              People

              Assignee:
              moodle.com moodle.com
              Reporter:
              sillyxone Huy Hoang
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: