Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'MDL-31426_22' of git://github.com/stronk7/moodle into M…

…OODLE_22_STABLE
  • Loading branch information...
commit 3d257cbf0890aafc0c91dc33df82d9b4ae99677f 2 parents 611d3bd + e163fbc
@nebgor nebgor authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 mod/forum/index.php
View
12 mod/forum/index.php
@@ -149,8 +149,13 @@
}
}
-/// Do course wide subscribe/unsubscribe
-if (!is_null($subscribe) and !isguestuser()) {
+// Do course wide subscribe/unsubscribe if requested
+if (!is_null($subscribe)) {
+ if (isguestuser() or !$can_subscribe) {
+ // there should not be any links leading to this place, just redirect
+ redirect(new moodle_url('/mod/forum/index.php', array('id' => $id)), get_string('subscribeenrolledonly', 'forum'));
+ }
+ // Can proceed now, the user is not guest and is enrolled
foreach ($modinfo->instances['forum'] as $forumid=>$cm) {
$forum = $forums[$forumid];
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
@@ -417,7 +422,8 @@
$PAGE->set_button($searchform);
echo $OUTPUT->header();
-if (!isguestuser() && isloggedin()) {
+// Show the subscribe all options only to non-guest, enrolled users
+if (!isguestuser() && isloggedin() && $can_subscribe) {
echo $OUTPUT->box_start('subscription');
echo html_writer::tag('div',
html_writer::link(new moodle_url('/mod/forum/index.php', array('id'=>$course->id, 'subscribe'=>1, 'sesskey'=>sesskey())),
Please sign in to comment.
Something went wrong with that request. Please try again.