From 02cf3958d21a6fb6940b04ab15c81f230216acab Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Tue, 28 Oct 2014 07:51:10 +0800 Subject: [PATCH] MDL-47909 mod_forum: Respect user autosubscribe setting on post Re-appropriate the forum autosubscribe setting as a discussion autosubscribe setting. The setting was no longer used after the per-discussion changes. The original plan had been to remove this setting, but there is some benefit to respecting it for discussion subscriptions instead. --- lang/en/moodle.php | 4 ++-- mod/forum/post.php | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 5caa7836f08..9d8ee545f95 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -160,8 +160,8 @@ $string['authenticateduserdescription'] = 'All logged in users.'; $string['authentication'] = 'Authentication'; $string['authenticationplugins'] = 'Authentication plugins'; $string['autosubscribe'] = 'Forum auto-subscribe'; -$string['autosubscribeno'] = 'No: don\'t automatically subscribe me to forums'; -$string['autosubscribeyes'] = 'Yes: when I post, subscribe me to that forum'; +$string['autosubscribeno'] = 'No: don\'t automatically subscribe me to forum discussions'; +$string['autosubscribeyes'] = 'Yes: when I post, subscribe me to that forum discussion'; $string['availability'] = 'Availability'; $string['availablecourses'] = 'Available courses'; $string['back'] = 'Back'; diff --git a/mod/forum/post.php b/mod/forum/post.php index 381e462f49a..91b7973f849 100644 --- a/mod/forum/post.php +++ b/mod/forum/post.php @@ -616,9 +616,8 @@ $postid = empty($post->id) ? null : $post->id; $draftid_editor = file_get_submitted_draft_itemid('message'); $currenttext = file_prepare_draft_area($draftid_editor, $modcontext->id, 'mod_forum', 'post', $postid, mod_forum_post_form::editor_options($modcontext, $postid), $post->message); -// Always suggest that the user be subscribed to a discussion that they're posting in unless they've already posted, in -// which case use their existing preference. -$discussionsubscribe = true; +// Respect the user's discussion autosubscribe preference unless they have already posted - in which case, use that preference. +$discussionsubscribe = $USER->autosubscribe; if (isset($discussion) && forum_user_has_posted($forum->id, $discussion->id, $USER->id)) { $discussionsubscribe = \mod_forum\subscriptions::is_subscribed($USER->id, $forum, $discussion->id, $cm); }