** Changed in: mahara Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of Mahara Contributors, which is subscribed to Mahara. Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it! https://bugs.launchpad.net/bugs/1667799
Title: Need a get_group_by_id() function Status in Mahara: Fix Released Bug description: Unlike view/collection etc 'group' functions are not in a class. And so there is no easy function to find group information by id. Instead we do a db query each time we want to find some group information and by the looks of the code we are not consistent each time, eg: $group = get_record('group', 'id', $id, 'deleted', 0); vs. $group = get_record('group', 'id', $id); At current count there is over 40 places where we fetch group by id via direct db call. It would be useful to have all those places fetch the info via function. That way we can have consistency across the system and also allow for the replying with additional information such as roles and whether one can edit or not, eg: get_group_by_id($id, $includedeleted = true, $getroles = false, $canedit = false) { if ($includedeletd) { $group = get_record('group', 'id', $groupid, 'deleted', 0); } else { $group = get_record('group', 'id', $groupid); } if (empty($group)) { return false; } if ($getroles) { $group->roles = group_user_access($group->id); } if ($canedit) { $group->canedit = $role && group_role_can_edit_views($group, $group->roles); } return $group; } To manage notifications about this bug go to: https://bugs.launchpad.net/mahara/+bug/1667799/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~mahara-contributors Post to : mahara-contributors@lists.launchpad.net Unsubscribe : https://launchpad.net/~mahara-contributors More help : https://help.launchpad.net/ListHelp