Forum not sending emails.

Forum not sending emails.

by William Claps -
Number of replies: 2

I know there are other posts about this, but I cant find anything useful.  No email are being sent from the "site news" forum.  I think it is a problem with permissions or roles.  Here is my cron output:

<!--StartFragment-->Server Time: Wed, 03 Oct 2007 17:52:48 -0400


Starting activity modules
Processing module function assignment_cron ...done.
Processing module function chat_cron ...done.
Processing module function forum_cron ...0 users were sent post 143, 'Student Officer Positions Available'
done.
Processing module function journal_cron ...done.
Processing module function scorm_cron ...done.
Processing module function wiki_cron ...done.
Processing module function workshop_cron ...done.
Processing module function exercise_cron ...done.
Finished activity modules
Starting blocks
Finished blocks

As you can see, 0 users were sent post #143.  Some other people reported having success by assigning roles to everyone.  At the moment, every user is assigned "authenticaded user" by default.  When I try to assign roles in the forum, it doesn't list anyone to send it to.  Any help would be greatly appreciated.  Thank you.

Average of ratings: -
In reply to William Claps

Re: Forum not sending emails.

by Nikolay Tsanov -

I had the same problem with version 1.9.4+ (Build: 20090218). I got the conclusion that , because of some unknown reason, Moodle doesn't record news forum subscriptions in the table mdl_forum_subscriptions.

1. You should add MANUALLY (e.g. using phpMyAdmin) subscriptions in table mdl_forum_subscriptions. The table is very simple: id, userid and forum fields, all numerical. You get userid and forum from tables mdl_user and mdl_forum (forum in mdl_forum_subscriptions is id in mdl_forum). id in mdl_forum_subscriptions is auto_increment, so don't enter anything there.

2. The above wouldn't help if your news forum forces everyone to be subscribed forever (i.e. mdl_forum_subscriptions doesn't count). The "limited solution" which I applied in this case involved code alteration. In file mod/forum/lib.php, find
function forum_subscribed_users($course, $forum, $groupid=0, $context = NULL)
then look for the following if-else statement (line 2523 in my version):
   if (forum_is_forcesubscribed($forum)) {
.....
    } else {
....
    }
The solution I've used is an one character alteration of the IF-statement - line

   if (forum_is_forcesubscribed($forum)) {

now reads

   if (!forum_is_forcesubscribed($forum)) {

i.e. I've added "!". Please beware that this is quick, BUT limited, brute-force solution which would help you ONLY if you are okay with all mdl_forum_subscriptions-enrolled users to receive notifications from ALL forums... and, ofcourse, you should have added all necessary records in the table mdl_forum_subscriptions, because this code alteration bypasses the built in mechanism for sending notifications from forums everyone has been forced to be subscribed in.