Commit 10b3bb9d authored by Nigel McNie's avatar Nigel McNie
Browse files

Wrap adding a user to a group up in a transaction. Remove a redundant line of code.

parent 9107b66c
......@@ -299,9 +299,11 @@ function group_add_user($groupid, $userid, $role=null) {
$role = get_field_sql('SELECT gt.defaultrole FROM {grouptype} gt, {group} g WHERE g.id = ? AND g.grouptype = gt.name', array($groupid));
}
$cm->role = $role;
db_begin();
insert_record('group_member', $cm);
delete_records('group_member_request', 'group', $groupid, 'member', $userid);
$user = optional_userobj($userid);
db_commit();
}
/**
......
Supports Markdown
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