X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fgroupmembers.php;h=54f1d8dcda748e8fb112c6042e9d4a14ac1f0ca7;hb=2b56d3b534389cba1d44c6f5ef4d1a8a514acda6;hp=b326a0df75f2b8f80b05f24c039789be96791bbd;hpb=fc61b7162576deb11a7947a8a04293b744f9d5fc;p=quix0rs-gnu-social.git diff --git a/actions/groupmembers.php b/actions/groupmembers.php index b326a0df75..54f1d8dcda 100644 --- a/actions/groupmembers.php +++ b/actions/groupmembers.php @@ -73,14 +73,21 @@ class GroupmembersAction extends GroupDesignAction } if (!$nickname) { - $this->clientError(_('No nickname'), 404); + $this->clientError(_('No nickname.'), 404); return false; } - $this->group = User_group::staticGet('nickname', $nickname); + $local = Local_group::staticGet('nickname', $nickname); + + if (!$local) { + $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); + $this->clientError(_('No such group.'), 404); return false; } @@ -93,7 +100,7 @@ class GroupmembersAction extends GroupDesignAction return sprintf(_('%s group members'), $this->group->nickname); } else { - return sprintf(_('%s group members, page %d'), + return sprintf(_('%1$s group members, page %2$d'), $this->group->nickname, $this->page); } @@ -192,17 +199,19 @@ class GroupMemberListItem extends ProfileListItem { $user = common_current_user(); - if (!empty($user) && $user->id != $this->profile->id && $user->isAdmin($this->group) && + if (!empty($user) && + $user->id != $this->profile->id && + ($user->isAdmin($this->group) || $user->hasRight(Right::MAKEGROUPADMIN)) && !$this->profile->isAdmin($this->group)) { $this->out->elementStart('li', 'entity_make_admin'); $maf = new MakeAdminForm($this->out, $this->profile, $this->group, - array('action' => 'groupmembers', - 'nickname' => $this->group->nickname)); + $this->returnToArgs()); $maf->show(); $this->out->elementEnd('li'); } } + function showGroupBlockForm() { $user = common_current_user(); @@ -210,12 +219,49 @@ class GroupMemberListItem extends ProfileListItem if (!empty($user) && $user->id != $this->profile->id && $user->isAdmin($this->group)) { $this->out->elementStart('li', 'entity_block'); $bf = new GroupBlockForm($this->out, $this->profile, $this->group, - array('action' => 'groupmembers', - 'nickname' => $this->group->nickname)); + $this->returnToArgs()); $bf->show(); $this->out->elementEnd('li'); } + } + + function linkAttributes() + { + $aAttrs = parent::linkAttributes(); + + if (common_config('nofollow', 'members')) { + $aAttrs['rel'] .= ' nofollow'; + } + + return $aAttrs; + } + + function homepageAttributes() + { + $aAttrs = parent::linkAttributes(); + + if (common_config('nofollow', 'members')) { + $aAttrs['rel'] = 'nofollow'; + } + return $aAttrs; + } + + /** + * Fetch necessary return-to arguments for the profile forms + * to return to this list when they're done. + * + * @return array + */ + protected function returnToArgs() + { + $args = array('action' => 'groupmembers', + 'nickname' => $this->group->nickname); + $page = $this->out->arg('page'); + if ($page) { + $args['param-page'] = $page; + } + return $args; } }