MDL-52642 blog: Fix notices for swapping contexts in activities.
[moodle.git] / blog / edit.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);