diff --git a/blog/index.php b/blog/index.php index 1f5217a37b5..ddbdf454245 100644 --- a/blog/index.php +++ b/blog/index.php @@ -76,7 +76,9 @@ $sitecontext = context_system::instance(); if (isset($userid) && $USER->id == $userid) { $blognode = $PAGE->navigation->find('siteblog', null); - $blognode->make_inactive(); + if ($blognode) { + $blognode->make_inactive(); + } } // Check basic permissions. diff --git a/blog/lib.php b/blog/lib.php index 50eaa357bf5..0be7e58a456 100644 --- a/blog/lib.php +++ b/blog/lib.php @@ -1023,12 +1023,17 @@ function blog_page_type_list($pagetype, $parentcontext, $currentcontext) { * @return bool */ function core_blog_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course) { + global $CFG; if (!blog_is_enabled_for_user() || isguestuser($user)) { // The guest user cannot post, so it is not possible to view any posts. // Also blogs might be disabled. // May as well just bail aggressively here. return true; } + if ($CFG->bloglevel == BLOG_USER_LEVEL && !$iscurrentuser) { + // Blogs are only viewable by the owner. + return true; + } $url = new moodle_url("/blog/index.php", array('userid' => $user->id)); if (!empty($course)) { $url->param('courseid', $course->id);