Commit 2a22b0ef authored by Robert Lyon's avatar Robert Lyon

Bug 1334576: Allowing admin setting for internal notification expiry

behatnotneeded

Change-Id: I7d6b761ebf28275a2608a6b1157c96da0922d5f0
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent f33fe8d9
......@@ -569,6 +569,14 @@ $siteoptionform = array(
'legend' => get_string('notificationsettings', 'admin'),
'elements' => array_merge(
array(
'internalnotificationexpire' => array(
'type' => 'text',
'size' => 4,
'title' => get_string('internalnotificationexpire', 'admin'),
'description' => get_string('internalnotificationexpiredescription', 'admin'),
'defaultvalue' => get_config('internalnotificationexpire') ? get_config('internalnotificationexpire') : 182,
'help' => true,
),
'activitydescription' => array(
'type' => 'html',
'class' => 'description',
......@@ -790,7 +798,7 @@ function siteoptions_submit(Pieform $form, $values) {
'defaultaccountlifetimeupdate', 'allowpublicviews', 'allowpublicprofiles', 'allowanonymouspages', 'generatesitemap',
'registration_sendweeklyupdates', 'mathjax', 'institutionexpirynotification', 'institutionautosuspend', 'requireregistrationconfirm',
'showselfsearchsideblock', 'nousernames', 'searchplugin', 'showtagssideblock',
'tagssideblockmaxtags', 'country', 'userscanchooseviewthemes',
'tagssideblockmaxtags', 'country', 'userscanchooseviewthemes', 'internalnotificationexpire',
'remoteavatars', 'userscanhiderealnames', 'antispam', 'spamhaus', 'surbl', 'anonymouscomments',
'recaptchaonregisterform', 'recaptchapublickey', 'recaptchaprivatekey', 'loggedinprofileviewaccess', 'disableexternalresources',
'proxyaddress', 'proxyauthmodel', 'proxyauthcredentials', 'smtphosts', 'smtpport', 'smtpuser', 'smtppass', 'smtpsecure',
......
......@@ -592,6 +592,8 @@ $string['emailsmtpsecuressl'] = 'SSL';
$string['emailsmtpsecuretls'] = 'TLS';
$string['emailnoreplyaddress'] = 'System mail address';
$string['emailnoreplyaddressdescription'] = 'Emails come out as from this address';
$string['internalnotificationexpire'] = 'Internal notification expiry';
$string['internalnotificationexpiredescription'] = 'The number of days to keep internal notifications';
$string['notificationsettings'] = 'Notification settings';
$string['notificationsettingsdescription'] = 'Here you can set the default options for new users to get notifications. Users can override these settings on their own "Settings → Notifications" page.<br>
If you select either of the email options, notifications will still arrive in the user\'s inbox, but they will be marked as read automatically.';
......
<!-- @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later -->
<!-- @copyright For copyright information on Mahara, please see the README file distributed with this software. -->
<h3>Internal notification expiry</h3>
<p>The following notification types will be deleted from your inbox
after the specified days have elapsed:</p>
<ul>
<li>Page access notifications</li>
<li>Watchlist notifications</li>
<li>Institution messages</li>
</ul>
......@@ -2,7 +2,8 @@
<!-- @copyright For copyright information on Mahara, please see the README file distributed with this software. -->
<h3>Inbox</h3>
<p>This is a list of system messages and notifications that apply to you. Use the "Notifications" page in the "Settings" area to decide how you will receive notifications. Once you have read a notification, you can mark it for removal from your list.</p>
<p><strong>Note:</strong> The following notification types expire automatically when you choose an email notification option and are deleted from your inbox after 6 months:</p>
<p><strong>Note:</strong> The following notification types expire automatically when you choose an email notification option and are
deleted from your inbox after the specified days in Site options → Notification settings → Internal notification expiry:</p>
<ul>
<li>Page access notifications</li>
<li>Watchlist notifications</li>
......
......@@ -6,7 +6,8 @@
<p><strong>Email:</strong> Your primary email address will receive an email each time the activity occurs.</p>
<p><strong>Email digest:</strong> Your primary email address will receive an email each day with a list of the activities of the last 24 hours.</p>
<p><strong>Note:</strong> If you select either email option, all activities will also be recorded in your inbox as they happen. They will all be marked as already read.</p>
<p>The following notifications expire automatically when you choose an email notification option and are deleted from your inbox after 6 months:</p>
<p>The following notifications expire automatically when you choose an email notification option and are deleted from your inbox after the specified days in Site options → Notification settings → Internal
notification expiry:</p>
<ul>
<li>Page access notifications</li>
<li>Watchlist notifications</li>
......
......@@ -2,7 +2,8 @@
<!-- @copyright For copyright information on Mahara, please see the README file distributed with this software. -->
<h3>Inbox</h3>
<p>This is a list of system activities or notifications that were sent to you. Use the "Notifications" page in the "Settings" area to decide how you want to receive these notifications. Once you have read a notification, you can mark it for removal from your list.</p>
<p><strong>Note:</strong> The following notification types expire automatically when you choose an email notification option and are deleted from your inbox after 6 months:</p>
<p><strong>Note:</strong> The following notification types expire automatically when you choose an email notification option and are
deleted from your inbox after the specified days in Site options → Notification settings → Internal notification expiry:</p>
<ul>
<li>Page access notifications</li>
<li>Watchlist notifications</li>
......
......@@ -118,6 +118,7 @@ class PluginNotificationInternal extends PluginNotification {
* @param $olderthandays integer the age an entry should at least be, before cleaning
*/
public static function clean_notifications($types, $olderthandays=182) {
$olderthandays = get_config('internalnotificationexpire') ? get_config('internalnotificationexpire') : $olderthandays;
$staletime = db_format_timestamp(time() - ($olderthandays * 24 * 60 * 60));
if (!is_array($types)) {
......
Markdown is supported
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