MDL-30386 - Blog - Adding RSS Feed link to the User blogs
authorJason Fowler <phalacee@gmail.com>
Wed, 30 Nov 2011 03:22:13 +0000 (11:22 +0800)
committerJason Fowler <phalacee@gmail.com>
Thu, 1 Dec 2011 01:07:21 +0000 (09:07 +0800)
blog/lib.php
lang/en/blog.php
lib/navigationlib.php

index 49ccdc6..9a407e9 100644 (file)
@@ -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
index ab7c6b4..1d54561 100644 (file)
@@ -138,6 +138,7 @@ $string['publishtoworld'] = 'Anyone in the world';
 $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}';
index 239021b..845cfe6 100644 (file)
@@ -1943,8 +1943,12 @@ class global_navigation extends navigation_node {
 
             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']);
+                    }
                 }
             }
         }