Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…ch post
  • Loading branch information...
commit 9fa231c541e3a1b7df0583158d5171631844418f 1 parent c967c71
sam_marshall authored
Showing with 15 additions and 0 deletions.
  1. +6 −0 blog/rsslib.php
  2. +9 −0 lib/rsslib.php
View
6 blog/rsslib.php
@@ -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
9 lib/rsslib.php
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.