From c000545dee67fc431276ef2e0b278ad144cf7871 Mon Sep 17 00:00:00 2001 From: Jason Fowler Date: Wed, 30 Nov 2011 11:22:13 +0800 Subject: [PATCH] MDL-30386 - Blog - Adding RSS Feed link 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..9a407e9c511d1 100644 --- a/blog/lib.php +++ b/blog/lib.php @@ -479,6 +479,13 @@ function blog_get_options_for_user(stdClass $user=null) { ); } } + if (has_capability('moodle/blog:view', $sitecontext) && $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 239021b46ee30..845cfe63e1486 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -1943,8 +1943,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']); + } } } }