Added event hooks for group subscribe

This commit is contained in:
Sarven Capadisli 2010-03-03 12:01:38 -05:00
parent ea10805e3f
commit b65ee23e82
2 changed files with 21 additions and 11 deletions

View File

@ -363,6 +363,14 @@ EndProfileRemoteSubscribe: After showing the link to remote subscription
- $userprofile: UserProfile widget - $userprofile: UserProfile widget
- &$profile: the profile being shown - &$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 StartProfilePageProfileSection: Starting to show the section of the
profile page with the actual profile data; profile page with the actual profile data;
hook to prevent showing the profile (e.g.) hook to prevent showing the profile (e.g.)

View File

@ -300,20 +300,22 @@ class ShowgroupAction extends GroupDesignAction
$this->elementStart('div', 'entity_actions'); $this->elementStart('div', 'entity_actions');
$this->element('h2', null, _('Group actions')); $this->element('h2', null, _('Group actions'));
$this->elementStart('ul'); $this->elementStart('ul');
$this->elementStart('li', 'entity_subscribe'); if (Event::handle('StartGroupSubscribe', array($this, $this->group))) {
$cur = common_current_user(); $this->elementStart('li', 'entity_subscribe');
if ($cur) { $cur = common_current_user();
if ($cur->isMember($this->group)) { if ($cur) {
$lf = new LeaveForm($this, $this->group); if ($cur->isMember($this->group)) {
$lf->show(); $lf = new LeaveForm($this, $this->group);
} else if (!Group_block::isBlocked($this->group, $cur->getProfile())) { $lf->show();
$jf = new JoinForm($this, $this->group); } else if (!Group_block::isBlocked($this->group, $cur->getProfile())) {
$jf->show(); $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('ul');
$this->elementEnd('div'); $this->elementEnd('div');
} }