Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-35653 - mod/wiki: Force format now lets users edit wiki pages.

Thanks to Tõnis Tartes for part of this solution.

When force format was selected in the options, trying to view the
wiki would redirect to the front page with a message saying that
you do not have permission to edit this page. Students had no way
of viewing any entries or creating the first page.

When in force format it skips a page , which would be considered
uncessary for students, but this means that the group id is not set
and this is what is causing most of the problems.

I also have included a check to see if the title is default and whether
the user has permission to view all groups. In these situations the
intermediate page is displayed.
  • Loading branch information...
commit c6b458edceb051c5cefd69d3fa316887a1bd4bdc 1 parent 4c7e6ea
Adrian Greeve authored
6  mod/wiki/create.php
@@ -111,14 +111,14 @@
111 111
     redirect($CFG->wwwroot . '/mod/wiki/edit.php?pageid='.$newpageid);
112 112
     break;
113 113
 case 'new':
114  
-    if ((int)$wiki->forceformat == 1 && !empty($title)) {
  114
+    // Go straight to editing if we know the page title and we're in force format mode.
  115
+    if ((int)$wiki->forceformat == 1 && $title != get_string('newpage', 'wiki')) {
115 116
         $newpageid = $wikipage->create_page($title);
116 117
         add_to_log($course->id, 'wiki', 'add page', "view.php?pageid=".$newpageid, $newpageid, $cm->id);
117 118
         redirect($CFG->wwwroot . '/mod/wiki/edit.php?pageid='.$newpageid);
118 119
     } else {
119  
-        // create link from moodle navigation block without pagetitle
120 120
         $wikipage->print_header();
121  
-        // new page without page title
  121
+        // Create a new page.
122 122
         $wikipage->print_content($title);
123 123
     }
124 124
     $wikipage->print_footer();
2  mod/wiki/pagelib.php
@@ -937,6 +937,8 @@ function create_page($pagetitle) {
937 937
         $data = $this->mform->get_data();
938 938
         if (isset($data->groupinfo)) {
939 939
             $groupid = $data->groupinfo;
  940
+        } else if (!empty($this->gid)) {
  941
+            $groupid = $this->gid;
940 942
         } else {
941 943
             $groupid = '0';
942 944
         }

0 notes on commit c6b458e

Please sign in to comment.
Something went wrong with that request. Please try again.