From f4528bdcfeac5da3169e9b563e80cb61aceb8d1e Mon Sep 17 00:00:00 2001 From: skodak Date: Sun, 3 Feb 2008 10:37:03 +0000 Subject: [PATCH] MDL-13306 option to skip logging of blocked emails in forum cron; merged from MOODLE_19_STABLE --- lang/en_utf8/forum.php | 2 ++ mod/forum/lib.php | 8 ++++++-- mod/forum/settings.php | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lang/en_utf8/forum.php b/lang/en_utf8/forum.php index 273bfbc54b..2caf2fa8db 100644 --- a/lang/en_utf8/forum.php +++ b/lang/en_utf8/forum.php @@ -26,6 +26,7 @@ $string['configcleanreadtime'] = 'The hour of the day to clean old posts from th $string['configdisplaymode'] = 'The default display mode for discussions if one isn\'t set.'; $string['configenablerssfeeds'] = 'This switch will enable the possibility of RSS feeds for all forums. You will still need to turn feeds on manually in the settings for each forum.'; $string['configenabletimedposts'] = 'Set to \'yes\' if you want to allow setting of display periods when posting a new forum discussion (Experimental as not yet fully tested)'; +$string['configlogblocked'] = 'Forum cron may log blocked attemts to send emails to users with disabled email.'; $string['configlongpost'] = 'Any post over this length (in characters not including HTML) is considered long. Posts displayed on the site front page, social format course pages, or user profiles are shortened to a natural break somewhere between the forum_shortpost and forum_longpost values.'; $string['configmanydiscussions'] = 'Maximum number of discussions shown in a forum per page'; $string['configmaxbytes'] = 'Default maximum size for all forum attachments on the site (subject to course limits and other local settings)'; @@ -115,6 +116,7 @@ $string['introsocial'] = 'An open forum for chatting about anything you want to' $string['introteacher'] = 'A forum for teacher-only notes and discussion'; $string['lastpost'] = 'Last post'; $string['learningforums'] = 'Learning forums'; +$string['logblocked'] = 'Log blocked emails'; $string['longpost'] = 'Long post'; $string['mailnow'] = 'Mail now'; $string['manydiscussions'] = 'Discussions per page'; diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 0cf1ef0cac..dd86b55465 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -292,7 +292,9 @@ function forum_cron() { foreach ($subusers as $postuser) { // do not try to mail users with stopped email if ($postuser->emailstop) { - add_to_log(SITEID, 'forum', 'mail blocked', '', '', 0, $postuser->id); + if (!empty($CFG->forum_logblocked)) { + add_to_log(SITEID, 'forum', 'mail blocked', '', '', 0, $postuser->id); + } continue; } // this user is subscribed to this forum @@ -500,7 +502,9 @@ function forum_cron() { } $postuser = $users[$digestpost->userid]; if ($postuser->emailstop) { - add_to_log(SITEID, 'forum', 'mail blocked', '', '', 0, $postuser->id); + if (!empty($CFG->forum_logblocked)) { + add_to_log(SITEID, 'forum', 'mail blocked', '', '', 0, $postuser->id); + } continue; } diff --git a/mod/forum/settings.php b/mod/forum/settings.php index d285fe2c70..4b8529ae86 100644 --- a/mod/forum/settings.php +++ b/mod/forum/settings.php @@ -60,4 +60,7 @@ $settings->add(new admin_setting_configselect('forum_enablerssfeeds', get_string $settings->add(new admin_setting_configcheckbox('forum_enabletimedposts', get_string('timedposts', 'forum'), get_string('configenabletimedposts', 'forum'), 0)); +$settings->add(new admin_setting_configcheckbox('forum_logblocked', get_string('logblocked', 'forum'), + get_string('configlogblocked', 'forum'), 1)); + ?> -- 2.39.5