Skip to content

Commit

Permalink
Add redirection + show deleted user info.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Oct 31, 2016
1 parent 6d851da commit 7e6069b
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions main/admin/user_list.php
Expand Up @@ -747,17 +747,24 @@ function status_filter($status) {
case 'delete_user':
if (api_is_platform_admin()) {
$user_to_delete = $_GET['user_id'];
$userToDeleteInfo = api_get_user_info($user_to_delete);
$current_user_id = api_get_user_id();

if ($deleteUserAvailable && api_global_admin_can_edit_admin($_GET['user_id'])) {
if ($userToDeleteInfo && $deleteUserAvailable && api_global_admin_can_edit_admin($_GET['user_id'])) {
if ($user_to_delete != $current_user_id && UserManager :: delete_user($_GET['user_id'])) {
$message = Display :: return_message(get_lang('UserDeleted'), 'confirmation');
$message = Display :: return_message(
get_lang('UserDeleted').': '.$userToDeleteInfo['complete_name_with_username'],
'confirmation'
);
} else {
$message = Display :: return_message(get_lang('CannotDeleteUserBecauseOwnsCourse'), 'error');
}
} else {
$message = Display :: return_message(get_lang('CannotDeleteUser'),'error');
$message = Display :: return_message(get_lang('CannotDeleteUser'), 'error');
}
Display::addFlash($message);
header('Location: '.api_get_self());
exit;
}
break;
case 'delete':
Expand Down Expand Up @@ -792,7 +799,8 @@ function status_filter($status) {

$searchAdvanced = '
<a id="advanced_params" href="javascript://" class = "btn btn-default advanced_options" onclick="display_advanced_search_form();">
<span id="img_plus_and_minus">&nbsp;'. Display::returnFontAwesomeIcon('arrow-right') . ' '.get_lang('AdvancedSearch').'
<span id="img_plus_and_minus">&nbsp;
'. Display::returnFontAwesomeIcon('arrow-right') . ' '.get_lang('AdvancedSearch').'
</span>
</a>';
$actionsLeft = '';
Expand Down

0 comments on commit 7e6069b

Please sign in to comment.