Make Wiki Table of Contents Read Only

Picture of Nancy K Hoke
Make Wiki Table of Contents Read Only

Greetings - In working a faculty member, he wishes to lock the index so the students cannot edit or change the name of a page.  I did some searching and I found a setting in Moodle 1.9 for a Wiki page allowing for the page to be set to Read Only. In 1.9 there are about 4-5 of these flags that can be set for the page  - but I cannot find the flags or the Read Only setting in the Wiki in Moodle 2.3.  Help!  As always thank you for your time and expertise.

Nancy K.

Average of ratings: -
Picture of John White
Re: Make Wiki Table of Contents Read Only

Hi Nancy,

Interesting question! From just searching the wiki code for 'readonly' I would guess that feature is no longer implemented - likely to do with the ethos of collaborative learning implicit in a wiki. Of course sometimes teachers would feel uncomfortable with the idea that students can cheerfully edit their carefully set up introductory page, thus throwing the gates wide open!

There still exists a 'readonly' field in the wiki_pages table in the database, so a very rudimentary lockout could be used, without necessarily having a settings page - but it does mean an Administrator would have to access the database to set the readonly field for precisely the right page to 1 (so it won't be all that convenient, but at least you will have the correct pageid in the address bar), and you need a small code fix...

In mod/wiki/edit.php around line 80 straight after:

$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('mod/wiki:editpage', $context);


if (!has_capability('mod/wiki:overridelock', $context)) {
  if ($page->readonly == 1) {
   print_error('readonlypage', 'wiki', $CFG->wwwroot . '/mod/wiki/view.php?pageid=' . $pageid);

You also have to add one extra line to your language file, e.g. mod/wiki/lang/en/wiki.php...

$string['readonlypage'] = 'This page cannot be edited';

The edits will block any ordinary 'editor' from changing the locked page, but still allow the teacher & admin to do so, assuming that the teacher has 'mod/wiki:overridelock' rights.

All the usual warnings apply... keep a backup copy of the file you're editing, use a text editor not a word processor to do the edit, backup your database.

Regards, John


Average of ratings: -