Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chamilo-lms/tests/scripts/delete_users_from_csv.php

27 lines
833 B

<?php
/* For licensing terms, see /license.txt */
exit;
require __DIR__.'/../../main/inc/global.inc.php';
api_protect_admin_script();
// Define origin and destination courses' code
$debug = true;
$file = 'file.csv';
$users = Import :: csv_to_array($file);
foreach ($users as $user) {
//$userInfo = api_get_user_info_from_username($user['UserName']);
$userInfo = api_get_user_info_from_email($user['Email']);
if ($userInfo) {
if ($debug == false) {
UserManager::delete_user($userInfo['user_id']);
echo 'User deleted: '.$userInfo['user_id'].' '.$userInfo['username'].'<br />';
} else {
echo 'User will be deleted: '.$userInfo['user_id'].' '.$userInfo['username'].'<br />';
}
} else {
echo 'user not found: "'.$user['UserName'].'"<br />';
}
}