MDL-52642 blog: Fix notices for swapping contexts in activities.
authorAdrian Greeve <adrian@moodle.com>
Tue, 12 Apr 2016 03:53:34 +0000 (11:53 +0800)
committerAdrian Greeve <adrian@moodle.com>
Tue, 12 Apr 2016 03:53:34 +0000 (11:53 +0800)
blog/edit.php
blog/index.php

index 8248039..6b13994 100644 (file)
@@ -64,9 +64,13 @@ if ($id) {
 
 $sitecontext = context_system::instance();
 $usercontext = context_user::instance($userid);
-$PAGE->set_context($usercontext);
-$blognode = $PAGE->settingsnav->find('blogadd', null);
-$blognode->make_active();
+if ($modid) {
+    $PAGE->set_context($sitecontext);
+} else {
+    $PAGE->set_context($usercontext);
+    $blognode = $PAGE->settingsnav->find('blogadd', null);
+    $blognode->make_active();
+}
 
 require_login($courseid);
 
index 1b64b42..5aa84bd 100644 (file)
@@ -62,7 +62,7 @@ if ($entryid and !isset($userid)) {
     $userid = $entry->userid;
 }
 
-if (isset($userid) && empty($courseid)) {
+if (isset($userid) && empty($courseid) && empty($modid)) {
     $context = context_user::instance($userid);
 } else if (!empty($courseid) && $courseid != SITEID) {
     $context = context_course::instance($courseid);