Skip to content

Commit

Permalink
Merge branch 'MDL-59688-master' of git://github.com/damyon/moodle
Browse files Browse the repository at this point in the history
danpoltawski committed Aug 29, 2017

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
2 parents faf83f3 + 80a2937 commit 4e597bf
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions lang/en/enrol.php
Original file line number Diff line number Diff line change
@@ -139,6 +139,7 @@
$string['uninstallmigrating'] = 'Migrating "{$a}" enrolments';
$string['unknowajaxaction'] = 'Unknown action requested';
$string['unlimitedduration'] = 'Unlimited';
$string['userremovedfromselectiona'] = 'User "{$a}" was removed from the selection.';
$string['usersearch'] = 'Search ';
$string['withselectedusers'] = 'With selected users';
$string['extremovedaction'] = 'External unenrol action';
18 changes: 16 additions & 2 deletions user/action_redir.php
Original file line number Diff line number Diff line change
@@ -114,6 +114,18 @@

$users = $manager->get_users_enrolments($userids);

$removed = array_diff($userids, array_keys($users));
if (!empty($removed)) {
// This manager does not filter by enrolment method - so we can get the removed users details.
$removedmanager = new course_enrolment_manager($PAGE, $course);
$removedusers = $removedmanager->get_users_enrolments($removed);

foreach ($removedusers as $removeduser) {
$msg = get_string('userremovedfromselectiona', 'enrol', fullname($removeduser));
\core\notification::warning($msg);
}
}

// We may have users from any kind of enrolment, we need to filter for the enrolment plugin matching the bulk action.
$matchesplugin = function($user) use ($plugin) {
foreach ($user->enrolments as $enrolment) {
@@ -123,12 +135,14 @@
}
return false;
};
$users = array_filter($users, $matchesplugin);
$filteredusers = array_filter($users, $matchesplugin);

if (empty($users)) {
if (empty($filteredusers)) {
redirect($returnurl, get_string('noselectedusers', 'bulkusers'));
}

$users = $filteredusers;

// Get the form for the bulk operation.
$mform = $operation->get_form($PAGE->url, array('users' => $users));
// If the mform is false then attempt an immediate process. This may be an immediate action that

0 comments on commit 4e597bf

Please sign in to comment.