Browse files

Merge branch 'MDL-30202' of git://github.com/rwijaya/moodle

  • Loading branch information...
2 parents 4202a91 + 52eebcc commit 20ab954b3c599a2d5e1137495d619b2e3fdca95d @nebgor nebgor committed Nov 30, 2011
Showing with 18 additions and 7 deletions.
  1. +7 −1 mod/forum/index.php
  2. +11 −6 mod/forum/lib.php
View
8 mod/forum/index.php
@@ -259,8 +259,14 @@
} else {
$tooltiptext = get_string('rsssubscriberssposts', 'forum');
}
+
+ if (!isloggedin() && $course->id == SITEID) {
+ $userid = guest_user()->id;
+ } else {
+ $userid = $USER->id;
+ }
//Get html code for RSS link
- $row[] = rss_get_link($context->id, $USER->id, 'mod_forum', $forum->id, $tooltiptext);
+ $row[] = rss_get_link($context->id, $userid, 'mod_forum', $forum->id, $tooltiptext);
} else {
$row[] = ' ';
}
View
17 mod/forum/lib.php
@@ -7500,7 +7500,16 @@ function forum_extend_settings_navigation(settings_navigation $settingsnav, navi
}
}
- if ($enrolled && !empty($CFG->enablerssfeeds) && !empty($CFG->forum_enablerssfeeds) && $forumobject->rsstype && $forumobject->rssarticles) {
+ if (!isloggedin() && $PAGE->course->id == SITEID) {
+ $userid = guest_user()->id;
+ } else {
+ $userid = $USER->id;
+ }
+
+ $hascourseaccess = ($PAGE->course->id == SITEID) || can_access_course($PAGE->course, $userid);
+ $enablerssfeeds = !empty($CFG->enablerssfeeds) && !empty($CFG->forum_enablerssfeeds);
+
+ if ($enablerssfeeds && $forumobject->rsstype && $forumobject->rssarticles && $hascourseaccess) {
if (!function_exists('rss_get_url')) {
require_once("$CFG->libdir/rsslib.php");
@@ -7511,11 +7520,7 @@ function forum_extend_settings_navigation(settings_navigation $settingsnav, navi
} else {
$string = get_string('rsssubscriberssposts','forum');
}
- if (!isloggedin()) {
- $userid = 0;
- } else {
- $userid = $USER->id;
- }
+
$url = new moodle_url(rss_get_url($PAGE->cm->context->id, $userid, "mod_forum", $forumobject->id));
$forumnode->add($string, $url, settings_navigation::TYPE_SETTING, null, null, new pix_icon('i/rss', ''));
}

0 comments on commit 20ab954

Please sign in to comment.