Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-32125 mod_forum: Updating subscription mode not reflecting subscr…

…ibers
  • Loading branch information...
commit d6c3051a52218143d0aecb9f17a9dbd588b06e8e 1 parent 215c189
@leblangi leblangi authored
Showing with 14 additions and 0 deletions.
  1. +8 −0 mod/forum/lib.php
  2. +6 −0 mod/forum/subscribe.php
View
8 mod/forum/lib.php
@@ -214,6 +214,14 @@ function forum_update_instance($forum, $mform) {
$DB->update_record('forum', $forum);
+ $modcontext = get_context_instance(CONTEXT_MODULE, $forum->coursemodule);
+ if (($forum->forcesubscribe == FORUM_INITIALSUBSCRIBE) && ($oldforum->forcesubscribe <> $forum->forcesubscribe)) {
+ $users = forum_get_potential_subscribers($modcontext, 0, 'u.id, u.email', '');
+ foreach ($users as $user) {
+ forum_subscribe($user->id, $forum->id);
+ }
+ }
+
forum_grade_item_update($forum);
return true;
View
6 mod/forum/subscribe.php
@@ -111,6 +111,12 @@
redirect($returnto, get_string("everyoneisnowsubscribed", "forum"), 1);
break;
case FORUM_INITIALSUBSCRIBE : // 2
+ if ($forum->forcesubscribe <> FORUM_INITIALSUBSCRIBE) {
+ $users = forum_get_potential_subscribers($context, 0, 'u.id, u.email', '');
+ foreach ($users as $user) {
+ forum_subscribe($user->id, $forum->id);
+ }
+ }
forum_forcesubscribe($forum->id, FORUM_INITIALSUBSCRIBE);
redirect($returnto, get_string("everyoneisnowsubscribed", "forum"), 1);
break;
Please sign in to comment.
Something went wrong with that request. Please try again.