summaryrefslogtreecommitdiff
path: root/start.php
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2012-10-30 02:52:43 +0100
committerSem <sembrestels@riseup.net>2012-10-30 02:52:43 +0100
commit971504c5c53593d63d74714acf3ae7321ec557c4 (patch)
treea246dad847746d2fdaf16472dffad15308d130a1 /start.php
parentb4ad2436f397f5f9f155a723f4a07bb3cc7eb32a (diff)
downloadsaravea_theme-971504c5c53593d63d74714acf3ae7321ec557c4.tar.gz
saravea_theme-971504c5c53593d63d74714acf3ae7321ec557c4.tar.bz2
Added group invitations in groups topbar icon.
Diffstat (limited to 'start.php')
-rw-r--r--start.php22
1 files changed, 20 insertions, 2 deletions
diff --git a/start.php b/start.php
index ae5f3d6..65ea0e5 100644
--- a/start.php
+++ b/start.php
@@ -31,10 +31,28 @@ function n1_theme_topbar_menu($hook, $type, $returnvalue, $params){
$user = elgg_get_logged_in_user_entity();
if (elgg_is_active_plugin('groups')) {
+
+ $ia = elgg_set_ignore_access(TRUE);
+ $num_invitations = elgg_get_entities_from_relationship(array(
+ 'relationship' => 'invited',
+ 'relationship_guid' => $user->guid,
+ 'inverse_relationship' => TRUE,
+ 'limit' => 0,
+ 'count' => TRUE,
+ ));
+ elgg_set_ignore_access($ia);
+
+ if ($num_invitations) {
+ $num_invitations = elgg_view('output/url', array(
+ 'text' => "<span class=\"messages-new\">$num_invitations</span>",
+ 'href' => "groups/invitations/$user->username",
+ ));
+ }
+
$returnvalue[] = ElggMenuItem::factory(array(
'name' => 'groups',
- 'href' => $user ? "groups/member/$user->username" : "groups/all",
- 'text' => elgg_view_icon('groups'),
+ 'href' => "groups/member/$user->username",
+ 'text' => elgg_view_icon('groups') . $num_invitations,
'title' => elgg_echo('groups'),
'priority' => 500,
));