}
$cur = common_current_user();
- $this->profile = $cur->getProfile();
+ if (empty($cur)) {
+ $this->clientError(_('Must be logged in.'), 403);
+ return false;
+ }
+ if ($this->arg('profile_id')) {
+ if ($cur->isAdmin($this->group)) {
+ $this->profile = Profile::staticGet('id', $this->arg('profile_id'));
+ } else {
+ $this->clientError(_('Only group admin can approve or cancel join requests.'), 403);
+ return false;
+ }
+ } else {
+ $this->profile = $cur->getProfile();
+ }
$this->request = Group_join_queue::pkeyGet(array('profile_id' => $this->profile->id,
'group_id' => $this->group->id));
if (empty($this->request)) {
- $this->clientError(_('You are not in the moderation queue for this group.'), 403);
+ $this->clientError(sprintf(_('%s is not in the moderation queue for this group.'), $this->profile->nickname), 403);
}
return true;
}