]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Added a num of friend requests on menu text and fixed a bug in decline message.
authorSem <sembrestels@riseup.net>
Fri, 9 Dec 2011 01:43:48 +0000 (02:43 +0100)
committerSem <sembrestels@riseup.net>
Fri, 9 Dec 2011 01:43:48 +0000 (02:43 +0100)
actions/friendrequest/decline.php
start.php

index 247023c60482eca8969098bc0d4e9969d71c8443..ca3f1c9e49a7fb3f22f0c0aa9f9d49fc137175d3 100644 (file)
@@ -4,7 +4,7 @@ $user = elgg_get_logged_in_user_entity();
 $friend = get_entity(sanitize_int(get_input("guid")));\r
 \r
 if(remove_entity_relationship($friend->guid, 'friendrequest', $user->guid)) {\r
-       system_message(elgg_echo("friendrequest:decline:success", array($user->name)));\r
+       system_message(elgg_echo("friendrequest:decline:success", array($friend->name)));\r
 } else {\r
        system_message(elgg_echo("friendrequest:decline:fail"));\r
 }\r
index f3ea460cc089f0c511c2f6fbec8ea7eafd015afd..3f01824ec22c249f7fdacb91f693d52f1a4987af 100644 (file)
--- a/start.php
+++ b/start.php
@@ -13,9 +13,19 @@ function friendrequest_init() {
        elgg_register_page_handler('friendrequests', 'friendrequest_page_handler');
        
        if (elgg_is_logged_in()) {
+               
+               $count = elgg_get_entities_from_relationship(array(
+                       'type' => 'user',
+                       'relationship' => 'friendrequest',
+                       'relationship_guid' => $page_owner->guid,
+                       'inverse_relationship' => true,
+                       'limit' => 0,
+                       'count' => true,
+               ));
+               
                $params = array(
                                'name' => 'friendrequests',
-                               'text' => elgg_echo('friendrequest'),
+                               'text' => elgg_echo('friendrequest').($count? " ($count)": ""),
                                'href' => "friendrequests",
                                'contexts' => array('friends'),
                );