Commit f9bfc075 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add internal admin notifications for new site admins

parent 20c82d27
...@@ -72,10 +72,7 @@ function adminusers_submit(Pieform $form, $values) { ...@@ -72,10 +72,7 @@ function adminusers_submit(Pieform $form, $values) {
execute_sql('UPDATE {usr} execute_sql('UPDATE {usr}
SET admin = 1 SET admin = 1
WHERE id IN (' . join(',', $values['users']) . ')'); WHERE id IN (' . join(',', $values['users']) . ')');
execute_sql('DELETE FROM {usr_activity_preference} activity_add_admin_defaults($values['users']);
WHERE activity IN (SELECT name FROM {activity_type}
WHERE admin = 1)
AND usr NOT IN (' . join(',', $values['users']) . ')');
db_commit(); db_commit();
$SESSION->add_ok_msg(get_string('adminusersupdated', 'admin')); $SESSION->add_ok_msg(get_string('adminusersupdated', 'admin'));
redirect('/admin/users/admins.php'); redirect('/admin/users/admins.php');
......
...@@ -182,6 +182,9 @@ function edituser_site_submit(Pieform $form, $values) { ...@@ -182,6 +182,9 @@ function edituser_site_submit(Pieform $form, $values) {
if ($USER->get('admin')) { // Not editable by institutional admins if ($USER->get('admin')) { // Not editable by institutional admins
$user->staff = (int) ($values['staff'] == 'on'); $user->staff = (int) ($values['staff'] == 'on');
$user->admin = (int) ($values['admin'] == 'on'); $user->admin = (int) ($values['admin'] == 'on');
if ($user->admin) {
activity_add_admin_defaults(array($user->id));
}
} }
// Authinstance can be changed by institutional admins if both the // Authinstance can be changed by institutional admins if both the
......
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