- parent::handle($args);
-
- $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__);
+ parent::handle();
+
+ try {
+ $result = $this->scoped->joinGroup($this->group);
+ } catch (Exception $e) {
+ common_log(LOG_ERR, sprintf("Couldn't join user %s to group %s: '%s'",
+ $this->scoped->nickname,
+ $this->group->nickname,
+ $e->getMessage()));
+ // TRANS: Server error displayed when joining a group failed in the database.
+ // TRANS: %1$s is the joining user's nickname, $2$s is the group nickname for which the join failed.