Index: mod/forum/lib.php =================================================================== --- mod/forum/lib.php (revision 13586) +++ mod/forum/lib.php (working copy) @@ -486,8 +486,10 @@ } else { $mailcount[$post->id]++; - // Mark post as read if forum_usermarksread is set off - if (!$CFG->forum_usermarksread) { + // Mark post as read if forum_usermarksread is set off + // and forum_emailmarksread is either on or unset + $emailmarksread = (!isset($CFG->forum_emailmarksread) or $CFG->forum_emailmarksread); + if (!$CFG->forum_usermarksread and $emailmarksread) { $userto->markposts[$post->id] = $post->id; } } @@ -741,8 +743,11 @@ $posttext .= forum_make_mail_text($course, $forum, $discussion, $post, $userfrom, $userto, true); $posthtml .= forum_make_mail_post($course, $forum, $discussion, $post, $userfrom, $userto, false, $canreply, true, false); - // Create an array of postid's for this user to mark as read. - if (!$CFG->forum_usermarksread) { + // Create an array of postid's for this user to mark as read. + // Mark post as read if forum_usermarksread is set off + // and forum_emailmarksread is either on or unset + $emailmarksread = (!isset($CFG->forum_emailmarksread) or $CFG->forum_emailmarksread); + if (!$CFG->forum_usermarksread and $emailmarksread) { $userto->markposts[$post->id] = $post->id; } } Index: mod/forum/settings.php =================================================================== --- mod/forum/settings.php (revision 13586) +++ mod/forum/settings.php (working copy) @@ -27,6 +27,10 @@ $settings->add(new admin_setting_configcheckbox('forum_trackreadposts', get_string('trackforum', 'forum'), get_string('configtrackreadposts', 'forum'), 1)); +// Select whether or not email notification of new posts marks the posts as read +$settings->add(new admin_setting_configcheckbox('forum_emailmarksread', get_string('emailmarksread', 'forum'), + get_string('configemailmarksread', 'forum'), 1)); + // Default number of days that a post is considered old $settings->add(new admin_setting_configtext('forum_oldpostdays', get_string('oldpostdays', 'forum'), get_string('configoldpostdays', 'forum'), 14, PARAM_INT)); Index: lang/en_utf8/forum.php =================================================================== --- lang/en_utf8/forum.php (revision 13586) +++ lang/en_utf8/forum.php (working copy) @@ -36,6 +36,7 @@ $string['configajaxrating'] = 'AJAX rating is a forum rating usability improvement. If enabled, users can rate forum posts almost instantly without needing to scroll to the bottom of the page and click the \'Send in my latest ratings\' button. This setting also requires AJAX to be enabled for the site and in user profiles.'; $string['configcleanreadtime'] = 'The hour of the day to clean old posts from the \'read\' table.'; $string['configdisplaymode'] = 'The default display mode for discussions if one isn\'t set.'; +$string['configemailmarksread'] = 'If selected, new posts will be marked as read after user is sent email notification of new posts.'; $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 attempts to send emails to users with disabled email.'; @@ -79,6 +80,7 @@ $string['edit'] = 'Edit'; $string['editedby'] = 'Edited by $a->name - original submission $a->date'; $string['editing'] = 'Editing'; +$string['emailmarksread'] = 'Email marks posts read'; $string['emptymessage'] = 'Something was wrong with your post. Perhaps you left it blank, or the attachment was too big. Your changes have NOT been saved.'; $string['everyonecanchoose'] = 'Everyone can choose to be subscribed'; $string['everyonecannowchoose'] = 'Everyone can now choose to be subscribed';