X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fjoingroup.php;h=235e5ab4c2c8ea792de834ce745079bd7c7dc45c;hb=3194a86caa02f5796f468a7d2ebc8e54139fb1cb;hp=05e33e7cb13163812117b47852cc403e4488e976;hpb=15b88697a7c182faead1bbddfe38b59fdc54a0a2;p=quix0rs-gnu-social.git diff --git a/actions/joingroup.php b/actions/joingroup.php index 05e33e7cb1..235e5ab4c2 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)); }