Commit b403d53f authored by Andrew Robert Nicols's avatar Andrew Robert Nicols Committed by Richard Mansfield

Show whether users have email disabled in the admin user editing page

Signed-off-by: default avatarAndrew Robert Nicols <andrew.nicols@luns.net.uk>
parent 446357e5
......@@ -78,6 +78,17 @@ if ($USER->get('admin')) {
'help' => true,
);
}
$elements['maildisabled'] = array(
'type' => 'radio',
'defaultvalue' => get_account_preference($user->id, 'maildisabled'),
'title' => get_string('email'),
'separator' => '<br>',
'options' => array(
0 => get_string('enabled', 'account'),
1 => get_string('disabled', 'account'),
),
'help' => true,
);
$elements['expiry'] = array(
'type' => 'date',
'title' => get_string('accountexpiry', 'admin'),
......@@ -174,6 +185,17 @@ function edituser_site_submit(Pieform $form, $values) {
}
}
if ($values['maildisabled'] == 0 && get_account_preference($user->id, 'maildisabled') == 1) {
// Reset the sent and bounce counts otherwise mail will be disabled
// on the next send attempt
$u = new StdClass;
$u->email = $USER->get('email');
$u->id = $USER->get('id');
update_bounce_count($u,true);
update_send_count($u,true);
}
set_account_preference($user->id, 'maildisabled', $values['maildisabled']);
// Authinstance can be changed by institutional admins if both the
// old and new authinstances belong to the admin's institutions
$remotename = get_field('auth_remote_user', 'remoteusername', 'authinstance', $user->authinstance, 'localusr', $user->id);
......
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