Switch things from calling Group_member::join & leave & calling events manually to running through Profile::joinGroup() && Profile::leaveGroup(), with the events encapsulated.

This commit is contained in:
Brion Vibber
2011-03-21 14:35:29 -07:00
parent 0bec9cfdbc
commit 541dfa04fe
17 changed files with 81 additions and 70 deletions

View File

@@ -68,10 +68,7 @@ class ForceGroupPlugin extends Plugin
$group = User_group::getForNickname($nickname);
if ($group && !$profile->isMember($group)) {
try {
if (Event::handle('StartJoinGroup', array($group, $user))) {
Group_member::join($group->id, $user->id);
Event::handle('EndJoinGroup', array($group, $user));
}
$profile->joinGroup($group);
} catch (Exception $e) {
// TRANS: Server exception.
// TRANS: %1$s is a user nickname, %2$s is a group nickname.