Commit 5a9f9775 authored by Robert Lyon's avatar Robert Lyon

Fixing up success message if adding self to institution (Bug #1358481)

When adding user to institution on admin/users/edit.php page and the
user you are editing is the same user you are logged in as it cause an
array missing index error.

Change-Id: I4afef6f8998598f77d4f135afd380f725fc310fe
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 6785a7f0
......@@ -792,11 +792,12 @@ function edituser_institution_submit(Pieform $form, $values) {
if ($user->id == $USER->id) {
$USER->join_institution($values['addinstitution']);
$USER->commit();
$userinstitutions = $USER->get('institutions');
}
else {
$user->join_institution($values['addinstitution']);
$userinstitutions = $user->get('institutions');
}
$userinstitutions = $user->get('institutions');
$SESSION->add_ok_msg(get_string('userinstitutionjoined', 'admin', $userinstitutions[$values['addinstitution']]->displayname));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment