From 9e5941882ea30511b9be7887da2b555399395f14 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Wed, 19 Dec 2012 15:39:04 -0500 Subject: Fixes #4633. Added the invitation count for group invitations page menu item. --- mod/groups/start.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'mod/groups/start.php') diff --git a/mod/groups/start.php b/mod/groups/start.php index 9dca7dc16..25ce56350 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -163,11 +163,21 @@ function groups_setup_sidebar_menus() { $url = "groups/owner/$user->username"; $item = new ElggMenuItem('groups:owned', elgg_echo('groups:owned'), $url); elgg_register_menu_item('page', $item); + $url = "groups/member/$user->username"; $item = new ElggMenuItem('groups:member', elgg_echo('groups:yours'), $url); elgg_register_menu_item('page', $item); + $url = "groups/invitations/$user->username"; - $item = new ElggMenuItem('groups:user:invites', elgg_echo('groups:invitations'), $url); + $invitations = groups_get_invited_groups($user->getGUID()); + if (is_array($invitations) && !empty($invitations)) { + $invitation_count = count($invitations); + $text = elgg_echo('groups:invitations:pending', array($invitation_count)); + } else { + $text = elgg_echo('groups:invitations'); + } + + $item = new ElggMenuItem('groups:user:invites', $text, $url); elgg_register_menu_item('page', $item); } } -- cgit v1.2.3 From bccc976f079590f0c989484a0a6237dc4a1b8615 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Wed, 19 Dec 2012 15:56:57 -0500 Subject: Refs #4633. Added join request count to page menu item. --- mod/groups/languages/en.php | 1 + mod/groups/start.php | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'mod/groups/start.php') diff --git a/mod/groups/languages/en.php b/mod/groups/languages/en.php index a9743f9d4..a817210c6 100644 --- a/mod/groups/languages/en.php +++ b/mod/groups/languages/en.php @@ -20,6 +20,7 @@ $english = array( 'groups:edit' => "Edit group", 'groups:delete' => 'Delete group', 'groups:membershiprequests' => 'Manage join requests', + 'groups:membershiprequests:pending' => 'Manage join requests (%s)', 'groups:invitations' => 'Group invitations', 'groups:invitations:pending' => 'Group invitations (%s)', diff --git a/mod/groups/start.php b/mod/groups/start.php index 25ce56350..4e49d9e55 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -144,9 +144,24 @@ function groups_setup_sidebar_menus() { if (elgg_in_context('group_profile')) { if (elgg_is_logged_in() && $page_owner->canEdit() && !$page_owner->isPublicMembership()) { $url = elgg_get_site_url() . "groups/requests/{$page_owner->getGUID()}"; + + $count = elgg_get_entities_from_relationship(array( + 'type' => 'user', + 'relationship' => 'membership_request', + 'relationship_guid' => $guid, + 'inverse_relationship' => true, + 'count' => true, + )); + + if ($count) { + $text = elgg_echo('groups:membershiprequests:pending', array($count)); + } else { + $text = elgg_echo('groups:membershiprequests'); + } + elgg_register_menu_item('page', array( 'name' => 'membership_requests', - 'text' => elgg_echo('groups:membershiprequests'), + 'text' => $text, 'href' => $url, )); } -- cgit v1.2.3