From cd1b845f6243b691b68472f70e6eeff0b7209773 Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Wed, 26 Aug 2015 08:02:42 +0100 Subject: [PATCH] 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. --- lib/rsslib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/rsslib.php b/lib/rsslib.php index 8312c9266a4..74696f885be 100644 --- a/lib/rsslib.php +++ b/lib/rsslib.php @@ -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'); }