mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-48029 mod_forum: Check for subscription before enrolling
This commit is contained in:
parent
dc3fab74ae
commit
ddb4a31d54
4 changed files with 14 additions and 3 deletions
|
@ -238,7 +238,9 @@
|
|||
echo $OUTPUT->heading(format_string($forum->name), 2);
|
||||
echo $OUTPUT->heading(format_string($discussion->name), 3, 'discussionname');
|
||||
|
||||
if ((!isguestuser() && isloggedin()) && has_capability('mod/forum:viewdiscussion', $modcontext)) {
|
||||
// is_guest should be used here as this also checks whether the user is a guest in the current course.
|
||||
// Guests and visitors cannot subscribe - only enrolled users.
|
||||
if ((!is_guest($modcontext, $USER) && isloggedin()) && has_capability('mod/forum:viewdiscussion', $modcontext)) {
|
||||
// Discussion subscription.
|
||||
if (\mod_forum\subscriptions::is_subscribable($forum)) {
|
||||
echo html_writer::div(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue