]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/cancelgroup.php
Split up some list/form classes, and get the 'approve' and 'cancel' links on group...
[quix0rs-gnu-social.git] / actions / cancelgroup.php
index 089b4d751e7f2ac7ea48d4403b2a0d1cf6f91881..68d7f39139db1e83fcc13a6573008243fc1de32f 100644 (file)
@@ -97,13 +97,26 @@ class CancelgroupAction extends Action
         }
 
         $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;
     }