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.
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');
}