Permalink
Browse files

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

…ibers
  • Loading branch information...
1 parent cce0d9a commit 4a913724d0daec26bdee9174300f2d29decc868a @leblangi leblangi committed Feb 6, 2013
Showing with 14 additions and 0 deletions.
  1. +8 −0 mod/forum/lib.php
  2. +6 −0 mod/forum/subscribe.php
View
@@ -212,6 +212,14 @@ function forum_update_instance($forum, $mform) {
$DB->update_record('forum', $forum);
+ $modcontext = context_module::instance($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
@@ -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;

0 comments on commit 4a91372

Please sign in to comment.