diff --git a/tag/index.php b/tag/index.php
index 7cd4f81ca67..dfdeb6022f2 100644
--- a/tag/index.php
+++ b/tag/index.php
@@ -99,35 +99,38 @@ if ($usercount > 0) {
// I was not able to use get_items_tagged_with() because it automatically
// tries to join on 'blog' table, since the itemtype is 'blog'. However blogs
// uses the post table so this would not really work. - Yu 29/8/07
-if ($blogs = blog_fetch_entries('', 10, 0, 'site', '', $tag->id)) {
+if (has_capability('moodle/blog:view', $systemcontext)) { // You have to see blogs obviously
- print_box_start('generalbox', 'tag-blogs');
+ if ($blogs = blog_fetch_entries('', 10, 0, 'site', '', $tag->id)) {
- print_heading(get_string('relatedblogs', 'tag'), '', 3);
+ print_box_start('generalbox', 'tag-blogs');
- echo '
';
- foreach ($blogs as $blog) {
- if ($blog->publishstate == 'draft') {
- $class = 'class="dimmed"';
- } else {
- $class = '';
+ print_heading(get_string('relatedblogs', 'tag'), '', 3);
+
+ echo '';
+ foreach ($blogs as $blog) {
+ if ($blog->publishstate == 'draft') {
+ $class = 'class="dimmed"';
+ } else {
+ $class = '';
+ }
+ echo '- ';
+ echo '';
+ echo format_string($blog->subject);
+ echo '';
+ echo ' - ';
+ echo '';
+ echo fullname($blog);
+ echo '';
+ echo ', '. userdate($blog->lastmodified);
+ echo '
';
}
- echo '- ';
- echo '';
- echo format_string($blog->subject);
- echo '';
- echo ' - ';
- echo '';
- echo fullname($blog);
- echo '';
- echo ', '. userdate($blog->lastmodified);
- echo '
';
+ echo '
';
+
+ echo ''.get_string('seeallblogs', 'tag').'...
';
+
+ print_box_end();
}
- echo '
';
-
- echo ''.get_string('seeallblogs', 'tag').'...
';
-
- print_box_end();
}