summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Vollick <psycotica0@gmail.com>2009-08-19 09:22:06 -0400
committerChristopher Vollick <psycotica0@gmail.com>2009-08-19 09:37:27 -0400
commitb4c345392372ca39e0a5061b281df2074575e9d7 (patch)
tree45f2f9c5d149afc5be866b7e65a9d2f3be9316e2
parentd647483a27faad7bf5297255a68b6b3b82426b88 (diff)
Resolve Group Aliases in showgroup.php
For Example, let's say 'alias' was an alias for the group 'group'. Previously, if you went to '/group/group' it'd work, but '/group/alias' it'd say "No Such Group". This was untrue. Now it checks aliases when it can't find a group with a given name. If it finds one it redirects you to the original group.
-rw-r--r--actions/showgroup.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/actions/showgroup.php b/actions/showgroup.php
index 4d8ba5fa8..b0cc1dbc7 100644
--- a/actions/showgroup.php
+++ b/actions/showgroup.php
@@ -130,8 +130,18 @@ class ShowgroupAction extends GroupDesignAction
$this->group = User_group::staticGet('nickname', $nickname);
if (!$this->group) {
- $this->clientError(_('No such group'), 404);
- return false;
+ $alias = Group_alias::staticGet('alias', $nickname);
+ if ($alias) {
+ $args = array('id' => $alias->group_id);
+ if ($this->page != 1) {
+ $args['page'] = $this->page;
+ }
+ common_redirect(common_local_url('groupbyid', $args), 301);
+ return false;
+ } else {
+ $this->clientError(_('No such group'), 404);
+ return false;
+ }
}
common_set_returnto($this->selfUrl());