Skip to content

Commit 9472790

Browse files
committed
Admin: Add option to export last login in user export - refs BT#21021
1 parent cff73e7 commit 9472790

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

main/admin/user_export.php

+9-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
$form->addElement('radio', 'file_type', null, 'CSV', 'csv');
5757
$form->addElement('radio', 'file_type', null, 'XLS', 'xls');
5858
$form->addElement('checkbox', 'addcsvheader', get_lang('AddCSVHeader'), get_lang('YesAddCSVHeader'), '1');
59+
$form->addElement('checkbox', 'addlastlogin', get_lang('IncludeLastLogin'), get_lang('IncludeLastLogin'), '1');
5960
$form->addElement('select', 'course_code', get_lang('OnlyUsersFromCourse'), $courses);
6061
$form->addElement('select', 'course_session', get_lang('OnlyUsersFromCourseSession'), $coursesSessions);
6162
$form->addButtonExport(get_lang('Export'));
@@ -95,7 +96,8 @@
9596
u.phone AS Phone,
9697
u.registration_date AS RegistrationDate,
9798
u.active AS Active,
98-
u.expiration_date
99+
u.expiration_date,
100+
u.last_login AS LastLogin
99101
";
100102
if (strlen($course_code) > 0) {
101103
$sql .= " FROM $user_table u, $course_user_table cu
@@ -151,6 +153,9 @@
151153
'Active',
152154
'ExpirationDate',
153155
];
156+
if ($export['addlastlogin'] == '1') {
157+
$data[0][] = 'LastLogin';
158+
}
154159
} else {
155160
$data[] = [
156161
'UserId',
@@ -167,6 +172,9 @@
167172
'Active',
168173
'ExpirationDate',
169174
];
175+
if ($export['addlastlogin'] == '1') {
176+
$data[0][] = 'LastLogin';
177+
}
170178
}
171179

172180
foreach ($extra_fields as $extra) {

0 commit comments

Comments
 (0)