Commit 7745271f authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Change group membership changed strings & only notify removals/additions if...


Change group membership changed strings & only notify removals/additions if there is at least one group in the list
Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent eac65fdb
......@@ -67,13 +67,12 @@ foreach (array_unique(array_merge($initialgroups, $resultgroups)) as $groupid) {
}
$groupdata = get_records_select_assoc('group', 'id IN (' . join(',', array_unique(array_merge($initialgroups, $resultgroups))) . ')');
$groupstoremovemail = '';
$groupstoaddmail = '';
if ($jointype == 'controlled') {
db_begin();
//remove group membership
if ($groupstoremove = array_diff($initialgroups, $resultgroups)) {
$groupstoremovemail = '';
foreach ($groupstoremove as $groupid) {
group_remove_user($groupid, $userid, $role=null);
$groupstoremovemail .= $groupdata[$groupid]->name . "\n";
......@@ -81,6 +80,7 @@ if ($jointype == 'controlled') {
}
//add group membership
if ($groupstoadd = array_diff($resultgroups, $initialgroups)) {
$groupstoaddmail = '';
foreach ($groupstoadd as $groupid) {
group_add_user($groupid, $userid, $role=null);
$groupstoaddmail .= $groupdata[$groupid]->name . "\n";
......
......@@ -79,10 +79,10 @@ $string['requestedmembershipin'] = 'Requested membership in:';
$string['controlledmembership'] = 'Controlled Group membership';
$string['invitemembership'] = 'Invite only membership';
$string['changedgroupmembership'] = 'Control Groups membership has changed sucessfully.';
$string['changedgroupmembershipsubject'] = 'You Control Groups membership has changed';
$string['addedtogroupsmessage'] = "%s has added you to controlled group(s):\n\n%s\n\n";
$string['removedfromgroupsmessage'] = "%s has removed you from controlled group(s):\n\n%s\n\n";
$string['changedgroupmembership'] = 'Group membership updated sucessfully.';
$string['changedgroupmembershipsubject'] = 'Your group memberships have been changed';
$string['addedtogroupsmessage'] = "%s has added you to the group(s):\n\n%s\n\n";
$string['removedfromgroupsmessage'] = "%s has removed you from the group(s):\n\n%s\n\n";
$string['cantremoveuserisadmin'] = "Tutor cannot remove admins and other tutorsmembers.";
$string['cantremovemember'] = "Tutor cannot remove members.";
......
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