Permalink
Browse files

MDL-50641 rss: fix front page rss links

Fallback to guest user token when no user is specified in rss_get_url
rather than generating a junk token which is no use to anyone, this
matches existing logic which has been in place in forum for a while
and avoids custom handling all over the place.
  • Loading branch information...
danpoltawski committed Aug 26, 2015
1 parent 6d392b3 commit cd1b845f6243b691b68472f70e6eeff0b7209773
Showing with 3 additions and 0 deletions.
  1. +3 −0 lib/rsslib.php
View
@@ -81,6 +81,9 @@ function rss_get_link($contextid, $userid, $componentname, $id, $tooltiptext='')
function rss_get_url($contextid, $userid, $componentname, $additionalargs) {
global $CFG;
require_once($CFG->libdir.'/filelib.php');
if (empty($userid)) {
$userid = guest_user()->id;
}
$usertoken = rss_get_token($userid);
return get_file_url($contextid.'/'.$usertoken.'/'.$componentname.'/'.$additionalargs.'/rss.xml', null, 'rssfile');
}

0 comments on commit cd1b845

Please sign in to comment.