Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[MDL-22112]

Redirecting to first page of the wiki when subwiki is changed and selected pages does not exists
  • Loading branch information...
commit 1fa2bd54aa532cbb49ae46dc52154fd4fc4eec51 1 parent b499db5
Jordi Piguillem authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 mod/wiki/view.php
View
10 mod/wiki/view.php
@@ -133,9 +133,15 @@
if (!empty($swid)){
// User wants to view another subwiki
if ($subwiki = wiki_get_subwiki($swid)){
+ // Trying to get the same page but from another subwiki
if (!$page = wiki_get_page_by_title($swid, $page->title)) {
- $url = new moodle_url('/mod/wiki/view.php', array('id'=>$subwiki->id));
- print_error('individualpagedoesnotexist', 'wiki', $url->out());
+ // That page does not exists
+ // Getting the first page of that wiki
+ $wiki = wiki_get_wiki($subwiki->wikiid);
+ if (!$page = wiki_get_page_by_title($swid, $wiki->firstpagetitle)){
+ $url = new moodle_url('/mod/wiki/view.php', array('id'=>$subwiki->id));
+ print_error('individualpagedoesnotexist', 'wiki', $url->out());
+ }
}
} else {
print_error('incorrectsubwikiid', 'wiki');
Please sign in to comment.
Something went wrong with that request. Please try again.