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.
This commit is contained in:
Dan Poltawski
2015-08-26 08:10:08 +01:00
parent 8fb6ac2cb7
commit c7fab83ae6
+3
View File
@@ -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');
}