+ if (empty($cur)) {
+ // TRANS: Client error displayed when trying to leave a group while not logged in.
+ $this->clientError(_('Must be logged in.'), 403);
+ }
+ if ($this->arg('profile_id')) {
+ if ($cur->isAdmin($this->group)) {
+ $this->profile = Profile::getKV('id', $this->arg('profile_id'));
+ } else {
+ // TRANS: Client error displayed when trying to approve or cancel a group join request without
+ // TRANS: being a group administrator.
+ $this->clientError(_('Only group admin can approve or cancel join requests.'), 403);
+ }
+ } else {
+ $this->profile = $cur->getProfile();
+ }