mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 12:45:04 +01:00
MDL-15317, when forum is invisible, only users with 'mod/forum:managesubscriptions' capability can subscrib forum, merged from MOODLE_19_STABLE.
This commit is contained in:
parent
6559096f2c
commit
2c1363e622
@ -116,14 +116,23 @@
|
||||
$learningforums[$forum->id] = $forum;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Do course wide subscribe/unsubscribe
|
||||
if (!is_null($subscribe) and !isguestuser() and !isguest()) {
|
||||
foreach ($modinfo->instances['forum'] as $forumid=>$cm) {
|
||||
$forum = $forums[$forumid];
|
||||
$cansub = false;
|
||||
if (has_capability('mod/forum:viewdiscussion', $cm)) {
|
||||
$cansub = true;
|
||||
}
|
||||
if ($cansub && $cm->visible == 0 &&
|
||||
!has_capability('mod/forum:managesubscriptions', $cm))
|
||||
{
|
||||
$cansub = false;
|
||||
}
|
||||
if (!forum_is_forcesubscribed($forum)) {
|
||||
$subscribed = forum_is_subscribed($USER->id, $forum);
|
||||
if ($subscribe && !$subscribed) {
|
||||
if ($subscribe && !$subscribed && $cansub) {
|
||||
forum_subscribe($USER->id, $forumid);
|
||||
} else if (!$subscribe && $subscribed) {
|
||||
forum_unsubscribe($USER->id, $forumid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user