Skip to content

Commit

Permalink
MDL-30386 - Blog - Adding RSS Feed link to the User blogs
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnfwlr committed Dec 1, 2011
1 parent a5b5881 commit c000545
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
7 changes: 7 additions & 0 deletions blog/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lang/en/blog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}';
Expand Down
8 changes: 6 additions & 2 deletions lib/navigationlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
}
}
}
Expand Down

0 comments on commit c000545

Please sign in to comment.