Commit 3ceb2f0c authored by Kevin Paxman's avatar Kevin Paxman Committed by Eric Bremner
Browse files

ISTWCMS-4799: use wcmsadmi@uwaterloo.ca for the site email unless something is...

ISTWCMS-4799: use wcmsadmi@uwaterloo.ca for the site email unless something is specified, and don't send notification emails.
parent 7bf9feee
......@@ -16,8 +16,8 @@ use Drupal\Core\Site\Settings;
function uw_base_profile_form_install_configure_form_alter(&$form, FormStateInterface $form_state) {
// Account information defaults.
$form['admin_account']['account']['name']['#default_value'] = 'wcmsadmin';
$form['site_information']['site_mail']['#default_value'] = 'wcmsadmin@uwaterloo.ca';
$form['admin_account']['account']['mail']['#default_value'] = 'wcmsadmin@uwaterloo.ca';
$form['site_information']['site_mail']['#default_value'] = 'wcmsadmi@uwaterloo.ca';
$form['admin_account']['account']['mail']['#default_value'] = 'wcmsadmi@uwaterloo.ca';
// Date/time settings.
$form['regional_settings']['site_default_country']['#default_value'] = 'CA';
......@@ -47,4 +47,21 @@ function uw_base_profile_conditional_installs() {
$modules = ['uw_site_dev'];
\Drupal::service('module_installer')->install($modules, TRUE);
}
// Enforce wcmsadmi@uwaterloo.ca as the site email if the default was used.
$config = \Drupal::service('config.factory')->getEditable('system.site');
if ($config->get('mail') == 'admin@example.com') {
$config->set('mail', 'wcmsadmi@uwaterloo.ca')->save();
}
// Enforce wcmsadmi@uwaterloo.ca as the wcmsadmin user email if the default was used.
$user = user_load_by_name('wcmsadmin');
if ($user && $user->getEmail() == 'admin@example.com') {
$user->setEmail('wcmsadmi@uwaterloo.ca');
$user->save();
}
// Enforce not sending update emails if the default was used.
$config = \Drupal::service('config.factory')->getEditable('update.settings');
if (in_array('admin@example.com', $config->get('notification.emails'))) {
$config->set('notification.emails', [])->save();
}
}
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