]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Added event hooks for group subscribe
authorSarven Capadisli <csarven@status.net>
Wed, 3 Mar 2010 17:01:38 +0000 (12:01 -0500)
committerSarven Capadisli <csarven@status.net>
Wed, 3 Mar 2010 17:01:38 +0000 (12:01 -0500)
EVENTS.txt
actions/showgroup.php

index a40855134e373e0563061b3ec059f920058e9fa7..2c3863f228e669877937ab62e9c14b929b54d5ed 100644 (file)
@@ -363,6 +363,14 @@ EndProfileRemoteSubscribe: After showing the link to remote subscription
 - $userprofile: UserProfile widget
 - &$profile: the profile being shown
 
+StartGroupSubscribe: Before showing the link to remote subscription
+- $action: the current action
+- $group: the group being shown
+
+EndGroupSubscribe: After showing the link to remote subscription
+- $action: the current action
+- $group: the group being shown
+
 StartProfilePageProfileSection: Starting to show the section of the
                               profile page with the actual profile data;
                               hook to prevent showing the profile (e.g.)
index 4e1fcb6c7b1cb86b253870a3d50c1fb998054ea6..a1dc3865bdbae98931adc47b59d2a48aa0ccfdbb 100644 (file)
@@ -300,20 +300,22 @@ class ShowgroupAction extends GroupDesignAction
         $this->elementStart('div', 'entity_actions');
         $this->element('h2', null, _('Group actions'));
         $this->elementStart('ul');
-        $this->elementStart('li', 'entity_subscribe');
-        $cur = common_current_user();
-        if ($cur) {
-            if ($cur->isMember($this->group)) {
-                $lf = new LeaveForm($this, $this->group);
-                $lf->show();
-            } else if (!Group_block::isBlocked($this->group, $cur->getProfile())) {
-                $jf = new JoinForm($this, $this->group);
-                $jf->show();
+        if (Event::handle('StartGroupSubscribe', array($this, $this->group))) {
+            $this->elementStart('li', 'entity_subscribe');
+            $cur = common_current_user();
+            if ($cur) {
+                if ($cur->isMember($this->group)) {
+                    $lf = new LeaveForm($this, $this->group);
+                    $lf->show();
+                } else if (!Group_block::isBlocked($this->group, $cur->getProfile())) {
+                    $jf = new JoinForm($this, $this->group);
+                    $jf->show();
+                }
             }
+            $this->elementEnd('li');
+            Event::handle('EndGroupSubscribe', array($this, $this->group));
         }
 
-        $this->elementEnd('li');
-
         $this->elementEnd('ul');
         $this->elementEnd('div');
     }