From 33f82b5ada858508d97d81a5e2c686b3ba7d0d9c Mon Sep 17 00:00:00 2001 From: Sem Date: Fri, 9 Dec 2011 02:43:48 +0100 Subject: Added a num of friend requests on menu text and fixed a bug in decline message. --- actions/friendrequest/decline.php | 2 +- start.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/actions/friendrequest/decline.php b/actions/friendrequest/decline.php index 247023c60..ca3f1c9e4 100644 --- a/actions/friendrequest/decline.php +++ b/actions/friendrequest/decline.php @@ -4,7 +4,7 @@ $user = elgg_get_logged_in_user_entity(); $friend = get_entity(sanitize_int(get_input("guid"))); if(remove_entity_relationship($friend->guid, 'friendrequest', $user->guid)) { - system_message(elgg_echo("friendrequest:decline:success", array($user->name))); + system_message(elgg_echo("friendrequest:decline:success", array($friend->name))); } else { system_message(elgg_echo("friendrequest:decline:fail")); } diff --git a/start.php b/start.php index f3ea460cc..3f01824ec 100644 --- 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'), ); -- cgit v1.2.3