MDL-52938 mod_forum: check global setting to track forum posts
authorMarina Glancy <marina@moodle.com>
Tue, 2 Feb 2016 02:53:47 +0000 (10:53 +0800)
committerMarina Glancy <marina@moodle.com>
Tue, 2 Feb 2016 02:54:22 +0000 (10:54 +0800)
user/forum.php

index 16cbb97..bd1052d 100644 (file)
@@ -47,7 +47,9 @@ if ($forumform->is_cancelled()) {
 
     $user->maildigest = $data->maildigest;
     $user->autosubscribe = $data->autosubscribe;
-    $user->trackforums = $data->trackforums;
+    if (!empty($CFG->forum_trackreadposts)) {
+        $user->trackforums = $data->trackforums;
+    }
 
     user_update_user($user, false, false);
 
@@ -57,7 +59,9 @@ if ($forumform->is_cancelled()) {
     if ($USER->id == $user->id) {
         $USER->maildigest = $data->maildigest;
         $USER->autosubscribe = $data->autosubscribe;
-        $USER->trackforums = $data->trackforums;
+        if (!empty($CFG->forum_trackreadposts)) {
+            $USER->trackforums = $data->trackforums;
+        }
     }
 
     redirect($redirect);