Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit f104e36

Browse files
committed
ENH: refs #0445. Show a user's community invitations on their user page
1 parent c04240b commit f104e36

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

core/controllers/UserController.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,23 @@ public function userpageAction()
692692
$filteredCommunities[] = $community;
693693
}
694694
}
695+
696+
// If this is the user's own page, show any pending community invitations
697+
if($this->logged && $this->userSession->Dao->getKey() == $userDao->getKey())
698+
{
699+
$invitations = $userDao->getInvitations();
700+
$communityInvitations = array();
701+
foreach($invitations as $invitation)
702+
{
703+
$community = $this->Community->load($invitation->getCommunityId());
704+
if($community)
705+
{
706+
$communityInvitations[] = $community;
707+
}
708+
}
709+
$this->view->communityInvitations = $communityInvitations;
710+
}
711+
695712
$this->view->userCommunities = $filteredCommunities;
696713
$this->view->folders = array();
697714
if(!empty($this->userSession->Dao) && ($userDao->getKey() == $this->userSession->Dao->getKey() || $this->userSession->Dao->isAdmin()))

core/views/user/userpage.phtml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,25 @@ $this->headScript()->appendFile($this->coreWebroot.'/public/js/common/common.bro
178178
<ul>";
179179

180180
foreach($this->userCommunities as $community)
181-
{
182-
echo "<li><a href='{$this->webroot}/community/{$community->getKey()}'>{$community->getName()}</a></li>";
183-
}
181+
{
182+
echo "<li><a href='{$this->webroot}/community/{$community->getKey()}'>{$community->getName()}</a></li>";
183+
}
184+
echo "
185+
</ul>
186+
</div>";
187+
}
188+
189+
if(!empty($this->communityInvitations))
190+
{
191+
echo "
192+
<div class='sideElement genericCommunities'>
193+
<h1>{$this->t('Community Invitations')}</h1>
194+
<ul>";
195+
196+
foreach($this->communityInvitations as $community)
197+
{
198+
echo "<li><a href='{$this->webroot}/community/{$community->getKey()}'>{$community->getName()}</a></li>";
199+
}
184200
echo "
185201
</ul>
186202
</div>";

0 commit comments

Comments
 (0)