Commit 2d27a5e9 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add unsubscribe link to forum post emails

parent e724aa6c
......@@ -400,6 +400,8 @@ class ActivityTypeInteractionForumNewPost extends ActivityTypePlugin {
$user->message = ($post->subject ? $post->subject . "\n" . str_repeat('-', strlen($post->subject)) . "\n" : '')
. trim(html2text($post->body));
}
$this->unsubscribename = $post->forumtitle;
$this->unsubscribeurl = get_config('wwwroot') . 'interaction/forum/view.php?id=' . $post->forumid;
}
public function get_subject($user) {
......
......@@ -30,6 +30,7 @@ $string['emailsubject'] = '%s';
$string['emailheader'] = 'You have been sent a notification from %s. Message follows:';
$string['emailfooter'] = 'This is an auto generated notification from %s. To update your notification preferences, visit %s';
$string['referurl'] = 'See %s';
$string['unsubscribemessage'] = "To unsubscribe from %s, visit\n%s";
$string['name'] = 'Email';
?>
......@@ -57,6 +57,10 @@ class PluginNotificationEmail extends PluginNotification {
}
}
if (isset($data->unsubscribeurl) && isset($data->unsubscribename)) {
$messagebody .= "\n\n" . get_string_from_language($lang, 'unsubscribemessage', 'notification.email', $data->unsubscribename, $data->unsubscribeurl);
}
$messagebody .= "\n\n$separator";
$prefurl = get_config('wwwroot') . 'account/activity/preferences/';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment