Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-39863 Administration: Show confirmation/notice and don't redirect…

… automatically
  • Loading branch information...
commit 607944809862ce7d73dcbcde4f8cc251a7316fb8 1 parent 1430866
@rajeshtaneja rajeshtaneja authored
Showing with 22 additions and 7 deletions.
  1. +11 −3 admin/user/user_bulk_confirm.php
  2. +11 −4 admin/user/user_bulk_delete.php
View
14 admin/user/user_bulk_confirm.php
@@ -23,6 +23,7 @@
//TODO: add support for large number of users
if ($confirm and confirm_sesskey()) {
+ $notifications = '';
list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
$rs = $DB->get_recordset_select('user', "id $in", $params, '', 'id, username, secret, confirmed, auth, firstname, lastname');
foreach ($rs as $user) {
@@ -32,12 +33,19 @@
$auth = get_auth_plugin($user->auth);
$result = $auth->user_confirm($user->username, $user->secret);
if ($result != AUTH_CONFIRM_OK && $result != AUTH_CONFIRM_ALREADY) {
- echo $OUTPUT->notification(get_string('usernotconfirmed', '', fullname($user, true)));
+ $notifications .= $OUTPUT->notification(get_string('usernotconfirmed', '', fullname($user, true)));
}
}
$rs->close();
- redirect($return, get_string('changessaved'));
-
+ echo $OUTPUT->box_start('generalbox', 'notice');
+ if (!empty($notifications)) {
+ echo $notifications;
+ } else {
+ echo $OUTPUT->notification(get_string('changessaved'), 'notifysuccess');
+ }
+ $continue = new single_button(new moodle_url($return), get_string('continue'), 'post');
+ echo $OUTPUT->render($continue);
+ echo $OUTPUT->box_end();
} else {
list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
$userlist = $DB->get_records_select_menu('user', "id $in", $params, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname');
View
15 admin/user/user_bulk_delete.php
@@ -23,20 +23,27 @@
//TODO: add support for large number of users
if ($confirm and confirm_sesskey()) {
-
+ $notifications = '';
list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
$rs = $DB->get_recordset_select('user', "id $in", $params);
foreach ($rs as $user) {
if (!is_siteadmin($user) and $USER->id != $user->id and delete_user($user)) {
unset($SESSION->bulk_users[$user->id]);
} else {
- echo $OUTPUT->notification(get_string('deletednot', '', fullname($user, true)));
+ $notifications .= $OUTPUT->notification(get_string('deletednot', '', fullname($user, true)));
}
}
$rs->close();
session_gc(); // remove stale sessions
- redirect($return, get_string('changessaved'));
-
+ echo $OUTPUT->box_start('generalbox', 'notice');
+ if (!empty($notifications)) {
+ echo $notifications;
+ } else {
+ echo $OUTPUT->notification(get_string('changessaved'), 'notifysuccess');
+ }
+ $continue = new single_button(new moodle_url($return), get_string('continue'), 'post');
+ echo $OUTPUT->render($continue);
+ echo $OUTPUT->box_end();
} else {
list($in, $params) = $DB->get_in_or_equal($SESSION->bulk_users);
$userlist = $DB->get_records_select_menu('user', "id $in", $params, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname');
Please sign in to comment.
Something went wrong with that request. Please try again.