Commit 00e34cdf authored by Hugh Davenport's avatar Hugh Davenport Committed by Gerrit Code Review
Browse files

Merge "Bug #952625 Pending registration expiry time"

parents a94fe24c 1a29beb6
......@@ -311,6 +311,14 @@ $siteoptionform = array(
'help' => true,
'disabled' => in_array('session_timeout', $OVERRIDDEN),
),
'defaultregistrationexpirylifetime' => array(
'type' => 'expiry',
'title' => get_string('defaultregistrationexpirylifetime', 'admin'),
'description' => get_string('defaultregistrationexpirylifetimedescription', 'admin'),
'defaultvalue' => get_config('defaultregistrationexpirylifetime'),
'help' => false,
'disabled' => in_array('defaultregistrationexpirylifetime', $OVERRIDDEN),
),
'defaultaccountlifetime' => array(
'type' => 'expiry',
'title' => get_string('defaultaccountlifetime', 'admin'),
......@@ -612,7 +620,7 @@ function siteoptions_fail(Pieform $form, $field) {
function siteoptions_submit(Pieform $form, $values) {
$fields = array(
'sitename','lang','theme', 'dropdownmenu',
'defaultaccountlifetime', 'defaultaccountinactiveexpire', 'defaultaccountinactivewarn',
'defaultaccountlifetime', 'defaultregistrationexpirylifetime', 'defaultaccountinactiveexpire', 'defaultaccountinactivewarn',
'allowpublicviews', 'allowpublicprofiles', 'generatesitemap',
'registration_sendweeklyupdates', 'institutionexpirynotification', 'institutionautosuspend',
'showselfsearchsideblock', 'searchusernames', 'searchplugin', 'showtagssideblock',
......
......@@ -127,7 +127,7 @@ A new user has requested to join the institution '%s'.
Because you are listed as an administrator of this institution you need to approve or deny this registration request. To do this, select the following link: %s
You will need to approve or deny this registration request within 2 weeks.
You will need to approve or deny this registration request within %s.
Details of the registration request follow:
......@@ -142,7 +142,7 @@ The %s Team";
$string['pendingregistrationadminemailhtml'] = "<p>Hi %s,</p>
<p>A new user has requested to join the institution '%s'.</p>
<p>Because you are listed as an administrator of this institution you need to approve or deny this registration request. To do this, select the following link: <a href='%s'>%s</a></p>
<p>You will need to approve or deny this registration request within 2 weeks.</p>
<p>You will need to approve or deny this registration request within %s.</p>
<p>Details of the registration request follows:</p>
<p>Name: %s</p>
<p>Email: %s</p>
......
......@@ -2200,6 +2200,18 @@ function auth_register_submit(Pieform $form, $values) {
$admins = get_column('usr', 'id', 'admin', 1, 'deleted', 0);
}
require_once(get_config('libroot') . 'pieforms/pieform/elements/expiry.php');
$expirytime = pieform_element_expiry_get_expiry_from_seconds(get_config('defaultregistrationexpirylifetime'));
if ($expirytime == null) {
$expirystring = get_config('defaultregistrationexpirylifetime') . ' ' . get_string('seconds', 'performance');
}
else if ($expirytime['units'] == 'noenddate') {
$expirystring = get_string('element.expiry.noenddate', 'pieforms');
}
else {
$expirystring = $expirytime['number'] . ' ' . get_string('element.expiry.' . $expirytime['units'], 'pieforms');
}
// email each admin
// @TODO Respect the notification preferences of the admins.
foreach ($admins as $admin) {
......@@ -2209,10 +2221,10 @@ function auth_register_submit(Pieform $form, $values) {
get_string('pendingregistrationadminemailsubject', 'auth.internal', $institution->displayname, get_config('sitename')),
get_string('pendingregistrationadminemailtext', 'auth.internal',
$adminuser->firstname, $institution->displayname, $pendingregistrationslink,
$fullname, $values['email'], $values['reason'], get_config('sitename')),
$expirystring, $fullname, $values['email'], $values['reason'], get_config('sitename')),
get_string('pendingregistrationadminemailhtml', 'auth.internal',
$adminuser->firstname, $institution->displayname, $pendingregistrationslink, $pendingregistrationslink,
$fullname, $values['email'], $values['reason'], get_config('sitename'))
$expirystring, $fullname, $values['email'], $values['reason'], get_config('sitename'))
);
}
email_user($user, null,
......
......@@ -306,6 +306,8 @@ $string['defaultaccountinactiveexpire'] = 'Default account inactivity time';
$string['defaultaccountinactiveexpiredescription'] = 'How long a user account will remain active without the user logging in';
$string['defaultaccountinactivewarn'] = 'Warning time for inactivity / expiry';
$string['defaultaccountinactivewarndescription'] = 'The time before user accounts are to expire or become inactive at which a warning message will be sent to them.';
$string['defaultregistrationexpirylifetime'] = 'Default registration expiry lifetime';
$string['defaultregistrationexpirylifetimedescription'] = 'How long registration applications that require an administrator action will stay active.';
$string['defaultaccountlifetime'] = 'Default account lifetime';
$string['defaultaccountlifetimedescription'] = 'If set, user accounts will expire after this period of time from when they have been created.';
$string['embeddedcontent'] = 'Embedded content';
......
......@@ -3126,5 +3126,9 @@ function xmldb_core_upgrade($oldversion=0) {
add_field($table, $field);
}
if ($oldversion < 2013011700) {
set_config('defaultregistrationexpirylifetime', 1209600);
}
return $status;
}
......@@ -752,6 +752,7 @@ function core_install_firstcoredata_defaults() {
set_config('session_timeout', 86400);
set_config('sitename', 'Mahara');
set_config('defaultregistrationexpirylifetime', 1209600);
set_config('defaultaccountinactivewarn', 604800);
set_config('creategroups', 'all');
set_config('createpublicgroups', 'all');
......
......@@ -30,7 +30,7 @@ defined('INTERNAL') || die();
$config = new StdClass;
// See https://wiki.mahara.org/index.php/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2012081300;
$config->version = 2013011700;
$config->release = '1.7.0dev';
$config->minupgradefrom = 2008040200;
$config->minupgraderelease = '1.0.0 (release tag 1.0.0_RELEASE)';
......
......@@ -103,7 +103,7 @@ if (isset($key)) {
$registrationid = $registration->id;
unset($registration->id);
unset($registration->expiry);
if ($expirytime = get_config('defaultaccountlifetime')) {
if ($expirytime = get_config('defaultregistrationexpirylifetime')) {
$registration->expiry = db_format_timestamp(time() + $expirytime);
}
$registration->lastlogin = db_format_timestamp(time());
......
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