- Article's author is showed if present.
- In forum posts feeds, show post->subject instead of discussion->name
- Description contents in every article are passed to format_text() to
show contents like the rest of Moodle.
$string['blocksetup'] = 'Setting up block tables';
$string['blocksuccess'] = '$a tables have been set up correctly';
$string['bycourseorder'] = 'By course order';
+$string['byname'] = 'by $a';
$string['cancel'] = 'Cancel';
$string['categories'] = 'Course categories';
$string['category'] = 'Category';
u.firstname userfirstname,
u.lastname userlastname,
p.message postmessage,
- p.created postcreated
+ p.created postcreated,
+ p.format postformat
FROM {$CFG->prefix}forum_discussions d,
{$CFG->prefix}forum_posts p,
{$CFG->prefix}user u
$item->author = fullname($user);
$item->pubdate = $rec->postcreated;
$item->link = $CFG->wwwroot."/mod/forum/discuss.php?d=".$rec->discussionid;
- $item->description = $rec->postmessage;
+ $item->description = format_text($rec->postmessage,$rec->postformat,NULL,$forum->course);
$items[] = $item;
$articlesleft--;
if ($articlesleft < 1) {
if ($recs = get_records_sql ("SELECT p.id postid,
d.id discussionid,
- d.name discussionname,
u.id userid,
u.firstname userfirstname,
u.lastname userlastname,
+ p.subject postsubject,
p.message postmessage,
- p.created postcreated
+ p.created postcreated,
+ p.format postformat
FROM {$CFG->prefix}forum_discussions d,
{$CFG->prefix}forum_posts p,
{$CFG->prefix}user u
foreach ($recs as $rec) {
unset($item);
unset($user);
- $item->title = $rec->discussionname;
+ $item->title = $rec->postsubject;
$user->firstname = $rec->userfirstname;
$user->lastname = $rec->userlastname;
$item->author = fullname($user);
$item->pubdate = $rec->postcreated;
$item->link = $CFG->wwwroot."/mod/forum/discuss.php?d=".$rec->discussionid."&parent=".$rec->postid;
- $item->description = $rec->postmessage;
+ $item->description = format_text($rec->postmessage,$rec->postformat,NULL,$forum->course);
$items[] = $item;
$articlesleft--;
if ($articlesleft < 1) {
//This function returns the rss XML code for every item passed in the array
//item->title: The title of the item
-//item->author: The author of the item
+//item->author: The author of the item. Optional !!
//item->pubdate: The pubdate of the item
//item->link: The link url of the item
//item->description: The content of the item
$result .= rss_full_tag("title",3,false,$item->title);
$result .= rss_full_tag("link",3,false,$item->link);
$result .= rss_full_tag("pubDate",3,false,date("r",$item->pubdate));
+ //Include the author if exists
+ if (isset($item->author)) {
+ $item->description = get_string("byname","",$item->author)."<p>".$item->description;
+ }
$result .= rss_full_tag("description",3,false,$item->description);
$result .= rss_end_tag("item",2,true);