summaryrefslogtreecommitdiff
path: root/actions/joingroup.php
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2010-01-13 13:37:04 +0000
committerSarven Capadisli <csarven@status.net>2010-01-13 13:37:04 +0000
commit543026b8d1411c7d71a6482d0649ab3523f489b8 (patch)
treeb4e4ac6a8f89411faf7a0cfd11fbe63a4a344a03 /actions/joingroup.php
parent21512910c1d882b62f921154209e6f3c4792f03b (diff)
parentc26246c4c3eb7fb4002e7280c0421ed2fa96b767 (diff)
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'actions/joingroup.php')
-rw-r--r--actions/joingroup.php16
1 files changed, 6 insertions, 10 deletions
diff --git a/actions/joingroup.php b/actions/joingroup.php
index 05e33e7cb..235e5ab4c 100644
--- a/actions/joingroup.php
+++ b/actions/joingroup.php
@@ -115,16 +115,12 @@ class JoingroupAction extends Action
$cur = common_current_user();
- $member = new Group_member();
-
- $member->group_id = $this->group->id;
- $member->profile_id = $cur->id;
- $member->created = common_sql_now();
-
- $result = $member->insert();
-
- if (!$result) {
- common_log_db_error($member, 'INSERT', __FILE__);
+ try {
+ if (Event::handle('StartJoinGroup', array($this->group, $cur))) {
+ Group_member::join($this->group->id, $cur->id);
+ Event::handle('EndJoinGroup', array($this->group, $cur));
+ }
+ } catch (Exception $e) {
$this->serverError(sprintf(_('Could not join user %1$s to group %2$s.'),
$cur->nickname, $this->group->nickname));
}