commit e8a3d2df7989a463d52f07cf813a509c24bb94ca Author: cdunham Date: Fri Apr 18 15:23:07 2014 -0700 Adding ability to mask the Name of the sender in forums diff --git a/mod/forum/lang/en/forum.php b/mod/forum/lang/en/forum.php index fac1454..d726477 100644 --- a/mod/forum/lang/en/forum.php +++ b/mod/forum/lang/en/forum.php @@ -99,6 +99,7 @@ $string['configmaxattachments'] = 'Default maximum number of attachments allowed $string['configmaxbytes'] = 'Default maximum size for all forum attachments on the site (subject to course limits and other local settings)'; $string['configoldpostdays'] = 'Number of days old any post is considered read.'; $string['configreplytouser'] = 'When a forum post is mailed out, should it contain the user\'s email address so that recipients can reply personally rather than via the forum? Even if set to \'Yes\' users can choose in their profile to keep their email address secret.'; +$string['configreplytoname'] = 'When a forum post is mailed out, should it contain the user\'s name or should it contain the course short name when not using the user\'s email.'; $string['configshortpost'] = 'Any post under this length (in characters not including HTML) is considered short (see below).'; $string['configtrackingtype'] = 'Default setting for read tracking.'; $string['configtrackreadposts'] = 'Set to \'yes\' if you want to track read/unread for each user.'; @@ -385,6 +386,7 @@ $string['repliesone'] = '{$a} reply so far'; $string['reply'] = 'Reply'; $string['replyforum'] = 'Reply to forum'; $string['replytouser'] = 'Use email address in reply'; +$string['replytoname'] = 'Use name in reply'; $string['resetforums'] = 'Delete posts from'; $string['resetforumsall'] = 'Delete all posts'; $string['resetdigests'] = 'Delete all per-user forum digest preferences'; diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 670a579..bd4a2e0 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -759,6 +759,11 @@ function forum_cron() { // Clone userfrom as it is referenced by $users. $cloneduserfrom = clone($userfrom); $cloneduserfrom->email = $CFG->noreplyaddress; + // If forum_replytoname is not set then send mail using the course shortname + if (empty($CFG->forum_replytoname)) { + $cloneduserfrom->firstname = $shortname; + $cloneduserfrom->lastname = ''; + } $eventdata->userfrom = $cloneduserfrom; } diff --git a/mod/forum/settings.php b/mod/forum/settings.php index 03e6afe..1a7ed31 100644 --- a/mod/forum/settings.php +++ b/mod/forum/settings.php @@ -32,6 +32,10 @@ if ($ADMIN->fulltree) { $settings->add(new admin_setting_configcheckbox('forum_replytouser', get_string('replytouser', 'forum'), get_string('configreplytouser', 'forum'), 1)); + // Use course short name instead of username when not using the replytouser + $settings->add(new admin_setting_configcheckbox('forum_replytoname', get_string('replytoname', 'forum'), + get_string('configreplytoname', 'forum'), 1)); + // Less non-HTML characters than this is short $settings->add(new admin_setting_configtext('forum_shortpost', get_string('shortpost', 'forum'), get_string('configshortpost', 'forum'), 300, PARAM_INT));