X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=actions%2Fshowgroup.php;h=17c37e4d79f82c15cf2ab5aad846b78f1625a9e8;hb=41dfea163460bb216483e8e12fff7a8afefbb4fb;hp=a0d05ba37a39f62c3861502968e5d89db53ecddc;hpb=29a25848dee2863b380779d6b8f979b66365d924;p=quix0rs-gnu-social.git diff --git a/actions/showgroup.php b/actions/showgroup.php index a0d05ba37a..17c37e4d79 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -388,18 +388,23 @@ class ShowgroupAction extends GroupDesignAction $this->elementStart('div', array('id' => 'entity_members', 'class' => 'section')); - $this->element('h2', null, _('Members')); + if (Event::handle('StartShowGroupMembersMiniList', array($this))) { - $pml = new ProfileMiniList($member, $this); - $cnt = $pml->show(); - if ($cnt == 0) { - $this->element('p', null, _('(None)')); - } + $this->element('h2', null, _('Members')); + + $gmml = new GroupMembersMiniList($member, $this); + $cnt = $gmml->show(); + if ($cnt == 0) { + $this->element('p', null, _('(None)')); + } - if ($cnt > MEMBERS_PER_SECTION) { - $this->element('a', array('href' => common_local_url('groupmembers', - array('nickname' => $this->group->nickname))), - _('All members')); + if ($cnt > MEMBERS_PER_SECTION) { + $this->element('a', array('href' => common_local_url('groupmembers', + array('nickname' => $this->group->nickname))), + _('All members')); + } + + Event::handle('EndShowGroupMembersMiniList', array($this)); } $this->elementEnd('div'); @@ -425,14 +430,6 @@ class ShowgroupAction extends GroupDesignAction function showStatistics() { - // XXX: WORM cache this - $members = $this->group->getMembers(); - $members_count = 0; - /** $member->count() doesn't work. */ - while ($members->fetch()) { - $members_count++; - } - $this->elementStart('div', array('id' => 'entity_statistics', 'class' => 'section')); @@ -446,7 +443,7 @@ class ShowgroupAction extends GroupDesignAction $this->elementStart('dl', 'entity_members'); $this->element('dt', null, _('Members')); - $this->element('dd', null, (is_int($members_count)) ? $members_count : '0'); + $this->element('dd', null, $this->group->getMemberCount()); $this->elementEnd('dl'); $this->elementEnd('div'); @@ -502,3 +499,26 @@ class GroupAdminSection extends ProfileSection return null; } } + +class GroupMembersMiniList extends ProfileMiniList +{ + function newListItem($profile) + { + return new GroupMembersMiniListItem($profile, $this->action); + } +} + +class GroupMembersMiniListItem extends ProfileMiniListItem +{ + function linkAttributes() + { + $aAttrs = parent::linkAttributes(); + + if (common_config('nofollow', 'members')) { + $aAttrs['rel'] .= ' nofollow'; + } + + return $aAttrs; + } +} +