Permalink
Browse files

MDL-19274 - Blog RSS feed should include information about tags in ea…

…ch post
  • Loading branch information...
1 parent c967c71 commit 9fa231c541e3a1b7df0583158d5171631844418f sam_marshall committed May 22, 2009
Showing with 15 additions and 0 deletions.
  1. +6 −0 blog/rsslib.php
  2. +9 −0 lib/rsslib.php
View
@@ -76,6 +76,12 @@ function blog_generate_rss_feed($type, $id, $tagid=0) {
$item->pubdate = $blogpost->lastmodified;
$item->link = $CFG->wwwroot.'/blog/index.php?postid='.$blogpost->id;
$item->description = format_text($blogpost->summary, $blogpost->format);
+ if ( !empty($CFG->usetags) && ($blogtags = tag_get_tags_array('post', $blogpost->id)) ) {
+ if ($blogtags) {
+ $item->tags = $blogtags;
+ }
+ $item->tagscheme = $CFG->wwwroot . '/tag';
+ }
$items[] = $item;
}
$articles = rss_add_items($items); /// Change structure to XML
View
@@ -213,6 +213,15 @@ function rss_add_items($items) {
if (isset($item->category)) {
$result .= rss_full_tag('category',3,false,$item->category);
}
+ if (isset($item->tags)) {
+ $attributes = array();
+ if (isset($item->tagscheme)) {
+ $attributes['domain'] = $item->tagscheme;
+ }
+ foreach ($item->tags as $tag) {
+ $result .= rss_full_tag('category', 3, false, $tag, $attributes);
+ }
+ }
$result .= rss_full_tag('title',3,false,strip_tags($item->title));
$result .= rss_full_tag('link',3,false,$item->link);
$result .= rss_add_enclosures($item);

0 comments on commit 9fa231c

Please sign in to comment.