Merge branch 'MDL-28489_master' of git://github.com/stronk7/moodle
authorSam Hemelryk <sam@moodle.com>
Mon, 29 Aug 2011 23:03:38 +0000 (11:03 +1200)
committerSam Hemelryk <sam@moodle.com>
Mon, 29 Aug 2011 23:03:38 +0000 (11:03 +1200)
index.php

index 747bb04..aff7187 100644 (file)
--- a/index.php
+++ b/index.php
                     if (! $newsforum = forum_get_course_forum($SITE->id, 'news')) {
                         print_error('cannotfindorcreateforum', 'forum');
                     }
-                    echo html_writer::tag('a', get_string('skipa', 'access', moodle_strtolower($newsforum->name)), array('href'=>'#skipsitenews', 'class'=>'skip-block'));
+
+                    // fetch news forum context for proper filtering to happen
+                    $newsforumcm = get_coursemodule_from_instance('forum', $newsforum->id, $SITE->id, false, MUST_EXIST);
+                    $newsforumcontext = get_context_instance(CONTEXT_MODULE, $newsforumcm->id, MUST_EXIST);
+
+                    $forumname = format_string($newsforum->name, true, array('context' => $newsforumcontext));
+                    echo html_writer::tag('a', get_string('skipa', 'access', moodle_strtolower(strip_tags($forumname))), array('href'=>'#skipsitenews', 'class'=>'skip-block'));
 
                     if (isloggedin()) {
                         $SESSION->fromdiscussion = $CFG->wwwroot;
                         } else {
                             $subtext = get_string('subscribe', 'forum');
                         }
-                        echo $OUTPUT->heading($newsforum->name, 2, 'headingblock header');
+                        echo $OUTPUT->heading($forumname, 2, 'headingblock header');
                         $suburl = new moodle_url('/mod/forum/subscribe.php', array('id' => $newsforum->id, 'sesskey' => sesskey()));
                         echo html_writer::tag('div', html_writer::link($suburl, $subtext), array('class' => 'subscribelink'));
                     } else {
-                        echo $OUTPUT->heading($newsforum->name, 2, 'headingblock header');
+                        echo $OUTPUT->heading($forumname, 2, 'headingblock header');
                     }
 
                     forum_print_latest_discussions($SITE, $newsforum, $SITE->newsitems, 'plain', 'p.modified DESC');