Commit 03ba33da authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Allow admin to change users' account expiry date

parent 0f8d3d63
......@@ -100,6 +100,7 @@ function edituser_unsuspend_submit(Pieform $form, $values) {
// Site-wide account settings
$currentdate = getdate();
$elements = array();
$elements['id'] = array(
'type' => 'hidden',
......@@ -131,6 +132,14 @@ if ($USER->get('admin')) {
'defaultvalue' => $user->admin,
);
}
$elements['expiry'] = array(
'type' => 'date',
'title' => get_string('accountexpiry', 'admin'),
'description' => get_string('accountexpirydescription', 'admin'),
'minyear' => $currentdate['year'] - 2,
'maxyear' => $currentdate['year'] + 20,
'defaultvalue' => $user->expiry
);
$elements['quota'] = array(
'type' => 'bytes',
'title' => get_string('filequota','admin'),
......@@ -199,6 +208,7 @@ function edituser_site_submit(Pieform $form, $values) {
}
$user->passwordchange = (int) ($values['passwordchange'] == 'on');
$user->quota = $values['quota'];
$user->expiry = db_format_timestamp($values['expiry']);
global $USER;
if ($USER->get('admin')) { // Not editable by institutional admins
......@@ -257,7 +267,6 @@ $elements = array(
);
$allinstitutions = get_records_assoc('institution');
$currentdate = getdate();
foreach ($user->get('institutions') as $i) {
$elements[$i->institution.'_settings'] = array(
'type' => 'fieldset',
......
......@@ -262,6 +262,8 @@ $string['sitestaffdescription'] = 'If checked, the user can create controlled Co
$string['siteadmins'] = 'Site Admins';
$string['siteadmin'] = 'Site administrator';
$string['siteadmindescription'] = 'Site administrators can to do anything and go anywhere on the site';
$string['accountexpiry'] = 'Account expires';
$string['accountexpirydescription'] = 'Date on which the user\'s login is automatically disabled.';
$string['suspended'] = 'Suspended';
$string['suspendedreason'] = 'Reason for suspension';
$string['suspendedreasondescription'] = 'The text that will be displayed to the user on their next login attempt.';
......
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