Skip to content

Commit

Permalink
add option to set lastname for suspended users
Browse files Browse the repository at this point in the history
  • Loading branch information
my-curiosity committed Nov 13, 2024
1 parent 76e5169 commit 4cc04f7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion classes/archiveduser.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ private function give_suspended_pseudo_user($id, $timestamp) {
// Usernames have to be unique therefore the id is used.
$cloneuser->username = get_config('tool_cleanupusers_settings', 'suspendusername') . $id;
$cloneuser->firstname = get_config('tool_cleanupusers_settings', 'suspendfirstname');
$cloneuser->lastname = '';
$cloneuser->lastname = get_config('tool_cleanupusers_settings', 'suspendlastname');
$cloneuser->suspended = 1;
$cloneuser->email = '';
$cloneuser->phone1 = '';
Expand Down
3 changes: 3 additions & 0 deletions lang/en/tool_cleanupusers.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
$string['pluginname'] = 'Clean up users';
$string['pluginsettingstitle'] = 'General settings';
$string['sett_suspendfirstname'] = 'Firstname for suspended';
$string['sett_suspendlastname'] = 'Lastname for suspended';
$string['sett_suspendfirstname_description'] = 'Choose a firstname for suspended users';
$string['sett_suspendlastname_description'] = 'Choose a lastname for suspended users';
$string['sett_suspendusername'] = 'Username for suspended';
$string['sett_suspendusername_description'] = 'Choose a username for suspended users (must be lowercase)';
$string['sett_title'] = 'Configure suspended users';
Expand All @@ -62,6 +64,7 @@
$string['subplugintype_userstatus'] = 'Returns the status of users';
$string['subplugintype_userstatus_plural'] = 'Returns the status of users';
$string['suspendfirstname'] = 'Anonym';
$string['suspendlastname'] = 'Anonym';
$string['suspendusername'] = 'anonym';
$string['toarchive'] = 'Manage users who will be archived';
$string['todelete'] = 'Manage users who will be deleted';
Expand Down
7 changes: 7 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@
get_string('suspendfirstname', 'tool_cleanupusers'),
PARAM_TEXT
));
$settings->add(new admin_setting_configtext(
'tool_cleanupusers_settings/suspendlastname',
get_string('sett_suspendlastname', 'tool_cleanupusers'),
get_string('sett_suspendlastname_description', 'tool_cleanupusers'),
get_string('suspendlastname', 'tool_cleanupusers'),
PARAM_TEXT
));
$ADMIN->add('tool_cleanupusers', $settings);
// Add entry for own settings.
$ADMIN->add('tool_cleanupusers', new admin_externalpage(
Expand Down

0 comments on commit 4cc04f7

Please sign in to comment.