Moodle

EVERYONE gets forums posts

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.9
  • Fix Version/s: 1.9.1
  • Component/s: Forum
  • Labels:
    None
  • Environment:
    OSX 10.4.11, MySQL 4.1.22, PHP 5.1.4
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

I just moved from 1.8.4+ to 1.9+ (20080308). I had an instructor post to his forum and EVERYONE in the system received an email about the forum post – not just the students currently enrolled in his class. And I received Failed Delivery notifications on all of them!

His forum was set to forced subscriptions, but that should only be for those enrolled in his course. I turned force subscriptions off in that forum but I am worried that other courses have forced subscriptions as well.

I just sent another test message in a closed site with no students assigned and it is doing the same thing.

There are no students assigned at the system level.

Issue Links

Activity

Hide
Scott Hand added a comment -

Keeping the discussion alive in: http://moodle.org/mod/forum/discuss.php?d=92223

Show
Scott Hand added a comment - Keeping the discussion alive in: http://moodle.org/mod/forum/discuss.php?d=92223
Hide
Eloy Lafuente (stronk7) added a comment -

Sound potentially important IMO. Can you, Petr, handle this? TIA!

Show
Eloy Lafuente (stronk7) added a comment - Sound potentially important IMO. Can you, Petr, handle this? TIA!
Hide
Petr Škoda (skodak) added a comment -

1/ there is a cleanup code in forum upgrade code that should delete all stale subscriptions
2/ there is a new test in forum cron that blocks sending to ppl that are not enrolled

thanks for the report

please reopen if necessary

note:commit in parent issue

Show
Petr Škoda (skodak) added a comment - 1/ there is a cleanup code in forum upgrade code that should delete all stale subscriptions 2/ there is a new test in forum cron that blocks sending to ppl that are not enrolled thanks for the report please reopen if necessary note:commit in parent issue
Hide
Eloy Lafuente (stronk7) added a comment -

Confirmed. Both upgrade code and cron-prevention worked ok here. Closing.

Show
Eloy Lafuente (stronk7) added a comment - Confirmed. Both upgrade code and cron-prevention worked ok here. Closing.
Hide
Andrew Miller added a comment -

I believe we're still seeing this issue with Moodle 1.9 + (Build: 20080430) – here's the sequence of events.

If I make a new forum and set "Force everyone to be subscribed?" to "Yes, Initially" then everyone with a Moodle account gets the forum notifications (whether enrolled or not). I can confirm this by clicking "Show/edit current subscribers" and seeing that there are hundreds of people subscribed (when there's actually only 2 people enrolled for the course in question).

If I set it to no subscriptions when creating the forum and afterwards modify that setting, things work as expected (people get subscribed to the forum as they're enrolled in the course).

I was going to open a new bug on this however it sounds like the same thing (please just let me know if I should open a new bug).

Thanks.

Show
Andrew Miller added a comment - I believe we're still seeing this issue with Moodle 1.9 + (Build: 20080430) – here's the sequence of events. If I make a new forum and set "Force everyone to be subscribed?" to "Yes, Initially" then everyone with a Moodle account gets the forum notifications (whether enrolled or not). I can confirm this by clicking "Show/edit current subscribers" and seeing that there are hundreds of people subscribed (when there's actually only 2 people enrolled for the course in question). If I set it to no subscriptions when creating the forum and afterwards modify that setting, things work as expected (people get subscribed to the forum as they're enrolled in the course). I was going to open a new bug on this however it sounds like the same thing (please just let me know if I should open a new bug). Thanks.
Hide
Eloy Lafuente (stronk7) added a comment -

Hi Andrew,

I've one course with 3 students and 2 teachers. (the site has more than 100 users).

Then I've added one new forum in that course, selecting "Yes, Initially"... and only the 5 enrolled users have been subscribed to the forum. So I really cannot reproduce your problem here.

Do you have some global role setting changed from default?

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Hi Andrew, I've one course with 3 students and 2 teachers. (the site has more than 100 users). Then I've added one new forum in that course, selecting "Yes, Initially"... and only the 5 enrolled users have been subscribed to the forum. So I really cannot reproduce your problem here. Do you have some global role setting changed from default? Ciao
Hide
Petr Škoda (skodak) added a comment -

This looks like a permission problem, please verify who has 'mod/forum:initialsubscriptions' and 'moodl/course:view'.

Show
Petr Škoda (skodak) added a comment - This looks like a permission problem, please verify who has 'mod/forum:initialsubscriptions' and 'moodl/course:view'.
Hide
Andrew Miller added a comment -

For Eloy - I don't believe there are any (however I will admit that I'm the backend technical support for this install while some of the frontend have full admin privileges – they're usually pretty about asking when changing things though). Also, what Moodle version are you runnning?

Petr - For the permissions, the roles are.... (leaving out teachers)

mod/forum:initialsubscriptions
-Administrator (my user) = Inherit
-Student = Allow
-Authenticated User = Inherit
-Guest = Inherit

moodle/course:view
-Administrator (my user) = Inherit
-Student = Allow
-Authenticated User = Inherit
-Guest = Allow

The odd thing is that it only subscribes the world when you choose "Yes, Iniitially" while creating the forum but not if you choose it later when updating the forum (when it does work as the help document states).

I also verified that this works the same way whether the forum type is "Standard forum for general use" or "A single simple discussion".

Thanks much for the response.

Show
Andrew Miller added a comment - For Eloy - I don't believe there are any (however I will admit that I'm the backend technical support for this install while some of the frontend have full admin privileges – they're usually pretty about asking when changing things though). Also, what Moodle version are you runnning? Petr - For the permissions, the roles are.... (leaving out teachers) mod/forum:initialsubscriptions -Administrator (my user) = Inherit -Student = Allow -Authenticated User = Inherit -Guest = Inherit moodle/course:view -Administrator (my user) = Inherit -Student = Allow -Authenticated User = Inherit -Guest = Allow The odd thing is that it only subscribes the world when you choose "Yes, Iniitially" while creating the forum but not if you choose it later when updating the forum (when it does work as the help document states). I also verified that this works the same way whether the forum type is "Standard forum for general use" or "A single simple discussion". Thanks much for the response.
Hide
Petr Škoda (skodak) added a comment -

Other roles may affect this too:
1/ Default role for all (usersdefaultuserroleid) - there must not be course:view nor forum:initialsubscriptions
2/ Role for (guestguestroleid) - there must not be course:view nor forum:initialsubscriptions
3/ Default frontpage (roledefaultfrontpageroleid) - all server users, you are not talking about frontpage here, so it should not matter, right?

Could you please file a new bug report and sum up the steps to reproduce this starting with fresh installation and latest cvs code?

Thanks

Show
Petr Škoda (skodak) added a comment - Other roles may affect this too: 1/ Default role for all (usersdefaultuserroleid) - there must not be course:view nor forum:initialsubscriptions 2/ Role for (guestguestroleid) - there must not be course:view nor forum:initialsubscriptions 3/ Default frontpage (roledefaultfrontpageroleid) - all server users, you are not talking about frontpage here, so it should not matter, right? Could you please file a new bug report and sum up the steps to reproduce this starting with fresh installation and latest cvs code? Thanks
Hide
Andrew Miller added a comment -

Just curious - have you tried reproducing this on your install?

I'll do my best but it's going to take me a while to find time to pull down from cvs (need to go look up how to do that and put up a fresh install (this was an emergency the other morning when it came up and I had to find a workaround....but summer is the absolute busiest time of the year here).

Show
Andrew Miller added a comment - Just curious - have you tried reproducing this on your install? I'll do my best but it's going to take me a while to find time to pull down from cvs (need to go look up how to do that and put up a fresh install (this was an emergency the other morning when it came up and I had to find a workaround....but summer is the absolute busiest time of the year here).
Hide
Petr Škoda (skodak) added a comment -

I was doing extensive testing several weeks ago when fixing forum mailing bugs, what puzzles me is that there is a
has_capability('moodle/course:view', get_context_instance(CONTEXT_COURSE, $course->id))

which prevents sending of mails to anybody who is not enrolled into course - that is why I think that somehow everybody is enrolled into your course which would explain it.

Show
Petr Škoda (skodak) added a comment - I was doing extensive testing several weeks ago when fixing forum mailing bugs, what puzzles me is that there is a has_capability('moodle/course:view', get_context_instance(CONTEXT_COURSE, $course->id)) which prevents sending of mails to anybody who is not enrolled into course - that is why I think that somehow everybody is enrolled into your course which would explain it.
Hide
Andrew Miller added a comment -

I just retested this with 2 different courses – one with 2 people enrolled as students and another with no one enrolled as a student.

So hmm....do you know if your fixes were included in the "Moodle 1.9 + (Build: 20080430)" release?

Show
Andrew Miller added a comment - I just retested this with 2 different courses – one with 2 people enrolled as students and another with no one enrolled as a student. So hmm....do you know if your fixes were included in the "Moodle 1.9 + (Build: 20080430)" release?
Hide
Petr Škoda (skodak) added a comment -

Yes, it is included in (Build: 20080430).

The problem is that there is not an easy way tell who has the course:view capability in course. You have to look into all roles I mentioned above and also verify all parent contexts of course (course categories and system context). It means that you can not be sure that only two users are enrolled in that course

Show
Petr Škoda (skodak) added a comment - Yes, it is included in (Build: 20080430). The problem is that there is not an easy way tell who has the course:view capability in course. You have to look into all roles I mentioned above and also verify all parent contexts of course (course categories and system context). It means that you can not be sure that only two users are enrolled in that course
Hide
Petr Škoda (skodak) added a comment -

Most probably the problem is in roel specified in usersdefaultuserroleid

Show
Petr Škoda (skodak) added a comment - Most probably the problem is in roel specified in usersdefaultuserroleid
Hide
Andrew Miller added a comment -

Fantastic – that was very helpful.

Before seeing your response, I remembered that I had a fresh Moodle 1.9+ install (for testing - 20080409) that I could check with (while not from CVS, it was a vanilla install....no changes on roles/permissions from the defaults). I verified with that that I wasn't seeing the same issue (meaning it was something with our permissions as you suggested).

I then saw your reply above and checked "defaultuserroleid" – it was set to "Guest" (apparently the default in older Moodle versions). After changing it to "Authenticated user", things are now working as they should.

So, I'm not sure if there should be any code changes....but having a big warning in the settings for defaultuserroleid might be a good idea (as in "you really, really want to set this to "Authenticated user" unless you know what you're doing").

Thanks again.

Show
Andrew Miller added a comment - Fantastic – that was very helpful. Before seeing your response, I remembered that I had a fresh Moodle 1.9+ install (for testing - 20080409) that I could check with (while not from CVS, it was a vanilla install....no changes on roles/permissions from the defaults). I verified with that that I wasn't seeing the same issue (meaning it was something with our permissions as you suggested). I then saw your reply above and checked "defaultuserroleid" – it was set to "Guest" (apparently the default in older Moodle versions). After changing it to "Authenticated user", things are now working as they should. So, I'm not sure if there should be any code changes....but having a big warning in the settings for defaultuserroleid might be a good idea (as in "you really, really want to set this to "Authenticated user" unless you know what you're doing"). Thanks again.
Hide
Petr Škoda (skodak) added a comment -

oh, there used to be some brute force hack in 1.7-1.8 that kind of worked around the guest role in $CFG->defaultuserroleid , we sure need to document this somewhere, thanks!

Show
Petr Škoda (skodak) added a comment - oh, there used to be some brute force hack in 1.7-1.8 that kind of worked around the guest role in $CFG->defaultuserroleid , we sure need to document this somewhere, thanks!
Hide
Andrew Miller added a comment -

Quite welcome – thanks for the help.

Show
Andrew Miller added a comment - Quite welcome – thanks for the help.
Hide
Helen Foster added a comment -

Note added to documentation about never setting the default role for all users to guest:
http://docs.moodle.org/en/User_policies

Show
Helen Foster added a comment - Note added to documentation about never setting the default role for all users to guest: http://docs.moodle.org/en/User_policies
Hide
Petr Škoda (skodak) added a comment -

MDL-14183 fixes this problem in 1.9.1, admins of older version have to fix it manually, thanks

Show
Petr Škoda (skodak) added a comment - MDL-14183 fixes this problem in 1.9.1, admins of older version have to fix it manually, thanks

Dates

  • Created:
    Updated:
    Resolved: