Commit a426904b authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add default notification method to site options (bug #628152)



Change-Id: Ic99bcaec94ccff2b89fdf638fb37c54e5bb0f205
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent e4ee6d38
......@@ -49,6 +49,14 @@ $searchpluginoptions = get_search_plugins();
$countries = getoptions_country();
$notificationmethods = array();
foreach (array_keys(plugins_installed('notification')) as $n) {
$notificationmethods[$n] = get_string('name', 'notification.' . $n);
}
if (!$notificationdefault = get_config('defaultnotificationmethod')) {
$notificationdefault = isset($notificationmethods['email']) ? 'email' : 'internal';
}
$spamtraps = available_spam_traps();
$siteoptionform = array(
'name' => 'siteoptions',
......@@ -454,6 +462,15 @@ $siteoptionform = array(
'disabled' => in_array('noreplyaddress', $OVERRIDDEN),
'help' => true,
),
'defaultnotificationmethod' => array(
'type' => 'select',
'title' => get_string('defaultnotificationmethod', 'admin'),
'description' => get_string('defaultnotificationmethoddescription', 'admin'),
'defaultvalue' => $notificationdefault,
'disabled' => in_array('defaultnotificationmethod', $OVERRIDDEN),
'options' => $notificationmethods,
'help' => true,
),
),
),
'generalsettings' => array(
......@@ -588,8 +605,8 @@ function siteoptions_submit(Pieform $form, $values) {
'tagssideblockmaxtags', 'country', 'viewmicroheaders', 'userscanchooseviewthemes',
'remoteavatars', 'userscanhiderealnames', 'antispam', 'spamhaus', 'surbl', 'anonymouscomments', 'loggedinprofileviewaccess', 'disableexternalresources',
'proxyaddress', 'proxyauthmodel', 'proxyauthcredentials', 'smtphosts', 'smtpport', 'smtpuser', 'smtppass', 'smtpsecure',
'noreplyaddress', 'homepageinfo', 'showonlineuserssideblock', 'onlineuserssideblockmaxusers', 'registerterms',
'allowmobileuploads', 'creategroups', 'createpublicgroups', 'allowgroupcategories', 'wysiwyg',
'noreplyaddress', 'defaultnotificationmethod', 'homepageinfo', 'showonlineuserssideblock', 'onlineuserssideblockmaxusers',
'registerterms', 'allowmobileuploads', 'creategroups', 'createpublicgroups', 'allowgroupcategories', 'wysiwyg',
);
// if public views are disabled, sitemap generation must also be disabled.
......
......@@ -418,6 +418,8 @@ $string['emailsmtpsecuressl'] = 'SSL';
$string['emailsmtpsecuretls'] = 'TLS';
$string['emailnoreplyaddress'] = 'System Mail Address';
$string['emailnoreplyaddressdescription'] = 'Emails come out as from this address';
$string['defaultnotificationmethod'] = 'Default notification method';
$string['defaultnotificationmethoddescription'] = 'Notification method for new users';
......
<h3>Default notification method</h3>
<p>The method used to send notifications to new users. If set to
'Inbox', notifications are kept on the site, and users must log in to
read them on their <a href="../../account/activity">Inbox</a> page.
Users can change this preference at any time in
their <a href="../../account/activity/preferences">notification
settings</a>.</p>
......@@ -142,11 +142,13 @@ function activity_get_users($activitytype, $userids=null, $userobjs=null, $admin
function activity_default_notification_method() {
static $method = null;
if (is_null($method)) {
if (in_array('email', array_map(create_function('$a', 'return $a->name;'), plugins_installed('notification')))) {
$method = 'email';
}
else {
$method = 'internal';
if (!$method = get_config('defaultnotificationmethod')) {
if (in_array('email', array_keys(plugins_installed('notification')))) {
$method = 'email';
}
else {
$method = 'internal';
}
}
}
return $method;
......
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