From 440c440aeb6ce8f23821103fc5f52d0f7be04ad9 Mon Sep 17 00:00:00 2001 From: Jason Fowler Date: Mon, 12 Dec 2011 11:59:00 +0800 Subject: [PATCH] MDL-30539 - Blog - Adding RSS Feed icon to the user blogs --- blog/lib.php | 7 +++++++ lang/en/blog.php | 1 + lib/navigationlib.php | 8 ++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/blog/lib.php b/blog/lib.php index 49ccdc6f27a4e..06ed8acc3e65c 100644 --- a/blog/lib.php +++ b/blog/lib.php @@ -479,6 +479,13 @@ function blog_get_options_for_user(stdClass $user=null) { ); } } + if ($canview && $CFG->enablerssfeeds) { + $options['rss'] = array( + 'string' => get_string('rssfeed', 'blog'), + 'link' => new moodle_url(rss_get_url($sitecontext->id, $USER->id, 'blog', 'user/'.$user->id)) + ); + } + // Cache the options $useroptions[$user->id] = $options; // Return the options diff --git a/lang/en/blog.php b/lang/en/blog.php index ab7c6b453b860..1d54561d87e6b 100644 --- a/lang/en/blog.php +++ b/lang/en/blog.php @@ -138,6 +138,7 @@ $string['readfirst'] = 'Read this first'; $string['relatedblogentries'] = 'Related blog entries'; $string['retrievedfrom'] = 'Retrieved from'; +$string['rssfeed'] = 'Blog RSS feed'; $string['searchterm'] = 'Search: {$a}'; $string['settingsupdatederror'] = 'An error has occurred, blog preference setting could not be updated'; $string['siteblog'] = 'Site blog: {$a}'; diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 3f85d03eae9a8..8dcab574fbbe6 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -1944,8 +1944,12 @@ protected function load_for_user($user=null, $forceforcontext=false) { if (count($options) > 0) { $blogs = $usernode->add(get_string('blogs', 'blog'), null, navigation_node::TYPE_CONTAINER); - foreach ($options as $option) { - $blogs->add($option['string'], $option['link']); + foreach ($options as $type => $option) { + if ($type == "rss") { + $blogs->add($option['string'], $option['link'], settings_navigation::TYPE_SETTING, null, null, new pix_icon('i/rss', '')); + } else { + $blogs->add($option['string'], $option['link']); + } } } }