From: moodler <moodler>
Date: Tue, 22 Apr 2008 05:56:21 +0000 (+0000)
Subject: Merged MDL-8566 from 1.9
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=dde73b9e6909a5e9ab0a4c5717e6e4d02edf5925;p=moodle.git

Merged MDL-8566 from 1.9
---

diff --git a/blog/header.php b/blog/header.php
index 7835ede37c..aee8625334 100755
--- a/blog/header.php
+++ b/blog/header.php
@@ -188,29 +188,35 @@ $navlinks = array();
                     $navlinks[] = array('name' => "$tagstring: $taginstance->name", 'link' => null, 'type' => 'misc');
                     $navigation = build_navigation($navlinks);
 
-                    print_header("$course->shortname: $blogstring", $course->fullname, $navigation,'','',true,$PAGE->get_extra_header_string());
-
                 } else {
                     $navlinks[] = array('name' => $blogstring, 'link' => null, 'type' => 'misc');
                     $navigation = build_navigation($navlinks);
-                    print_header("$course->shortname: $blogstring", $course->fullname, $navigation,'','',true,$PAGE->get_extra_header_string());
                 }
+                print_header("$course->shortname: $blogstring", $course->fullname, $navigation,'','',true,$PAGE->get_extra_header_string());
 
             } else {
 
             //in top view
 
-                if ($tagid || !empty($tag)) {
+                if ($postid) {
                     $navlinks[] = array('name' => fullname($user),
                                         'link' => "$CFG->wwwroot/user/view.php?id=$filterselect",
                                         'type' => 'misc');
                     $navlinks[] = array('name' => $blogstring,
                                         'link' => "index.php?filtertype=user&amp;filterselect=$filterselect",
                                         'type' => 'misc');
-                    $navlinks[] = array('name' => "$tagstring: $taginstance->name", 'link' => null, 'type' => 'misc');
+                    $navlinks[] = array('name' => format_string($postobject->subject), 'link' => null, 'type' => 'misc');
                     $navigation = build_navigation($navlinks);
 
-                    print_header("$SITE->shortname: $blogstring", $SITE->fullname, $navigation,'','',true,$PAGE->get_extra_header_string());
+                } else if ($tagid || !empty($tag)) {
+                    $navlinks[] = array('name' => fullname($user),
+                                        'link' => "$CFG->wwwroot/user/view.php?id=$filterselect",
+                                        'type' => 'misc');
+                    $navlinks[] = array('name' => $blogstring,
+                                        'link' => "index.php?filtertype=user&amp;filterselect=$filterselect",
+                                        'type' => 'misc');
+                    $navlinks[] = array('name' => "$tagstring: $taginstance->name", 'link' => null, 'type' => 'misc');
+                    $navigation = build_navigation($navlinks);
 
                 } else {
                     $navlinks[] = array('name' => fullname($user),
@@ -218,9 +224,8 @@ $navlinks = array();
                                         'type' => 'misc');
                     $navlinks[] = array('name' => $blogstring, 'link' => null, 'type' => 'misc');
                     $navigation = build_navigation($navlinks);
-                    print_header("$SITE->shortname: $blogstring", $SITE->fullname, $navigation,'','',true,$PAGE->get_extra_header_string());
-
                 }
+                print_header("$SITE->shortname: $blogstring", $SITE->fullname, $navigation,'','',true,$PAGE->get_extra_header_string());
 
             }
         break;
diff --git a/blog/index.php b/blog/index.php
index 71ea5b7050..27044896dd 100755
--- a/blog/index.php
+++ b/blog/index.php
@@ -40,8 +40,16 @@ if (empty($filtertype)) {
         $filtertype = 'user';
         $filterselect = $userid;
     } else if (has_capability('moodle/blog:view', $sitecontext) and $CFG->bloglevel > BLOG_USER_LEVEL) {
-        $filtertype = 'site';
-        $filterselect = '';
+        if ($postid) {
+            $filtertype = 'user';
+            if (!$postobject = get_record('post', 'module', 'blog', 'id', $postid)) {
+                error('No such blog entry');
+            }
+            $filterselect = $postobject->userid;
+        } else {
+            $filtertype = 'site';
+            $filterselect = '';
+        }
     } else {
         // user might have capability to write blogs, but not read blogs at site level
         // users might enter this url manually without parameters