From e6858d7203bd36923f6251968bede6f4b271bf84 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 25 Feb 2010 08:44:15 -0500 Subject: modify group actions so they use Local_group to look up by nickname --- actions/showgroup.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'actions/showgroup.php') diff --git a/actions/showgroup.php b/actions/showgroup.php index eb1238902..0139ba157 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -122,7 +122,15 @@ class ShowgroupAction extends GroupDesignAction return false; } - $this->group = User_group::staticGet('nickname', $nickname); + $local = Local_group::staticGet('nickname', $nickname); + + if (!$local) { + common_log(LOG_NOTICE, "Couldn't find local group for nickname '$nickname'"); + $this->clientError(_('No such group.'), 404); + return false; + } + + $this->group = User_group::staticGet('id', $local->group_id); if (!$this->group) { $alias = Group_alias::staticGet('alias', $nickname); -- cgit v1.2.3-54-g00ecf From c95daacfdb6d89098716b8eeccfdd82124019d7a Mon Sep 17 00:00:00 2001 From: Christopher Vollick Date: Fri, 26 Feb 2010 10:10:38 -0500 Subject: Updated ShowGroup to Resolve Aliases Again. The way we find groups changed with this new Local_group table. I had to update this too. --- actions/showgroup.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'actions/showgroup.php') diff --git a/actions/showgroup.php b/actions/showgroup.php index 0139ba157..4e1fcb6c7 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -125,14 +125,6 @@ class ShowgroupAction extends GroupDesignAction $local = Local_group::staticGet('nickname', $nickname); if (!$local) { - common_log(LOG_NOTICE, "Couldn't find local group for nickname '$nickname'"); - $this->clientError(_('No such group.'), 404); - return false; - } - - $this->group = User_group::staticGet('id', $local->group_id); - - if (!$this->group) { $alias = Group_alias::staticGet('alias', $nickname); if ($alias) { $args = array('id' => $alias->group_id); @@ -142,11 +134,19 @@ class ShowgroupAction extends GroupDesignAction common_redirect(common_local_url('groupbyid', $args), 301); return false; } else { + common_log(LOG_NOTICE, "Couldn't find local group for nickname '$nickname'"); $this->clientError(_('No such group.'), 404); return false; } } + $this->group = User_group::staticGet('id', $local->group_id); + + if (!$this->group) { + $this->clientError(_('No such group.'), 404); + return false; + } + common_set_returnto($this->selfUrl()); return true; -- cgit v1.2.3-54-g00ecf From b65ee23e8293c301f8b142320eabff6c4acdfcfe Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 3 Mar 2010 12:01:38 -0500 Subject: Added event hooks for group subscribe --- EVENTS.txt | 8 ++++++++ actions/showgroup.php | 24 +++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) (limited to 'actions/showgroup.php') diff --git a/EVENTS.txt b/EVENTS.txt index a40855134..2c3863f22 100644 --- a/EVENTS.txt +++ b/EVENTS.txt @@ -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.) diff --git a/actions/showgroup.php b/actions/showgroup.php index 4e1fcb6c7..a1dc3865b 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -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'); } -- cgit v1.2.3-54-g00ecf From 6ff994b14c93c51f1af1a52d568ffb3391d9c6db Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Wed, 3 Mar 2010 16:25:17 -0500 Subject: Fix to group join event position. --- actions/showgroup.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'actions/showgroup.php') diff --git a/actions/showgroup.php b/actions/showgroup.php index a1dc3865b..5704b13d1 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -300,8 +300,8 @@ class ShowgroupAction extends GroupDesignAction $this->elementStart('div', 'entity_actions'); $this->element('h2', null, _('Group actions')); $this->elementStart('ul'); + $this->elementStart('li', 'entity_subscribe'); if (Event::handle('StartGroupSubscribe', array($this, $this->group))) { - $this->elementStart('li', 'entity_subscribe'); $cur = common_current_user(); if ($cur) { if ($cur->isMember($this->group)) { @@ -312,10 +312,9 @@ class ShowgroupAction extends GroupDesignAction $jf->show(); } } - $this->elementEnd('li'); Event::handle('EndGroupSubscribe', array($this, $this->group)); } - + $this->elementEnd('li'); $this->elementEnd('ul'); $this->elementEnd('div'); } -- cgit v1.2.3-54-g00ecf