From: skodak Date: Thu, 3 Jul 2008 14:09:27 +0000 (+0000) Subject: MDL-15021 Deleted not fully setup separate admin settings; merged from MOODLE_18_STAB... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a4a57da9e275d28b9a9fbe6f0ad4a1d8d3228909;p=moodle.git MDL-15021 Deleted not fully setup separate admin settings; merged from MOODLE_18_STABLE but with better delete --- diff --git a/admin/cron.php b/admin/cron.php index 3ace8d8f18..a1ef004569 100644 --- a/admin/cron.php +++ b/admin/cron.php @@ -285,8 +285,8 @@ /// Delete users who haven't completed profile within required period - if (!empty($CFG->deleteunconfirmed)) { - $cuttime = $timenow - ($CFG->deleteunconfirmed * 3600); + if (!empty($CFG->deleteincompleteusers)) { + $cuttime = $timenow - ($CFG->deleteincompleteusers * 3600); $rs = $DB->get_recordset_sql ("SELECT id, username FROM {user} WHERE confirmed = 1 AND lastaccess > 0 @@ -294,7 +294,7 @@ AND (lastname = '' OR firstname = '' OR email = '')", array($cuttime)); foreach ($rs as $user) { - if ($DB->delete_records('user', array('id'=>$user->id))) { + if (delete_user($user)) { mtrace("Deleted not fully setup user $user->username ($user->id)"); } } diff --git a/admin/settings/server.php b/admin/settings/server.php index 472f106e87..7e7b79901e 100644 --- a/admin/settings/server.php +++ b/admin/settings/server.php @@ -187,6 +187,15 @@ $temp->add(new admin_setting_configselect('deleteunconfirmed', get_string('delet 6 => get_string('numhours', '', 6), 1 => get_string('numhours', '', 1)))); +$temp->add(new admin_setting_configselect('deleteincompleteusers', get_string('deleteincompleteusers', 'admin'), get_string('configdeleteincompleteusers', 'admin'), 0, array(0 => get_string('never'), + 168 => get_string('numdays', '', 7), + 144 => get_string('numdays', '', 6), + 120 => get_string('numdays', '', 5), + 96 => get_string('numdays', '', 4), + 72 => get_string('numdays', '', 3), + 48 => get_string('numdays', '', 2), + 24 => get_string('numdays', '', 1)))); + $temp->add(new admin_setting_configselect('loglifetime', get_string('loglifetime', 'admin'), get_string('configloglifetime', 'admin'), 0, array(0 => get_string('neverdeletelogs'), 1000 => get_string('numdays', '', 1000), 365 => get_string('numdays', '', 365), diff --git a/lang/en_utf8/admin.php b/lang/en_utf8/admin.php index f5c4dff00f..dc27e8a959 100644 --- a/lang/en_utf8/admin.php +++ b/lang/en_utf8/admin.php @@ -88,6 +88,7 @@ $string['configdefaultcourseroleid'] = 'Users who enrol in a course will be auto $string['configdefaultrequestcategory'] = 'Courses requested by users will be automatically placed in this category.'; $string['configdefaultrequestedcategory'] = 'Default category to put courses that were requested into, if they\'re approved.'; $string['configdefaultuserroleid'] = 'All logged in users will be given the capabilities of the role you specify here, at the site level, in ADDITION to any other roles they may have been given. The default is the Authenticated user role (or Guest role in older versions). Note that this will not conflict with other roles they have, it just ensures that all users have capabilities that are not assignable at the course level (eg post blog entries, manage own calendar, etc).'; +$string['configdeleteincompleteusers'] = 'After this period, old not fully setup accounts are deleted.'; $string['configdeleteunconfirmed'] = 'If you are using email authentication, this is the period within which a response will be accepted from users. After this period, old unconfirmed accounts are deleted.'; $string['configdenyemailaddresses'] = 'To deny email addresses from particular domains list them here in the same way. All other domains will be accepted. To deny subdomains add the domain with a preceding \'.\'. eg hotmail.com yahoo.co.uk .live.com'; $string['configdigestmailtime'] = 'People who choose to have emails sent to them in digest form will be emailed the digest daily. This setting controls which time of day the daily mail will be sent (the next cron that runs after this hour will send it).'; @@ -292,7 +293,8 @@ $string['defaultsettinginfo'] = 'Default: $a'; $string['defaultuserroleid'] = 'Default role for all users'; $string['defaultvalues'] = 'Default values'; $string['deleteerrors'] = 'Delete errors'; -$string['deleteunconfirmed'] = 'Delete unconfirmed users after'; +$string['deleteincompleteusers'] = 'Delete incomplete users after'; +$string['deleteunconfirmed'] = 'Delete not fully setup users after'; $string['deleteuser'] = 'Delete user'; $string['density'] = 'Density'; $string['denyemailaddresses'] = 'Denied email domains';