diff options
author | Sem <sembrestels@riseup.net> | 2011-12-10 01:24:32 +0100 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2011-12-10 01:24:32 +0100 |
commit | b19fa6f54d89137ca55b3ddd343c5f22da16839a (patch) | |
tree | d324015d8311e1cb806dec4c48087bac52786b27 | |
parent | e1081bd87837f5bf5fdbaf26b4b9bb8e50c61ff5 (diff) | |
download | elgg-b19fa6f54d89137ca55b3ddd343c5f22da16839a.tar.gz elgg-b19fa6f54d89137ca55b3ddd343c5f22da16839a.tar.bz2 |
Removed "Friends of" menu item.
-rw-r--r-- | start.php | 28 |
1 files changed, 17 insertions, 11 deletions
@@ -12,18 +12,8 @@ function friendrequest_init() { //This will let users view their friend requests elgg_register_page_handler('friendrequests', 'friendrequest_page_handler'); - if (elgg_is_logged_in()) { - $count = friendrequest_count(); - $params = array( - 'name' => 'friendrequests', - 'text' => elgg_echo('friendrequest').($count? " ($count)": ""), - 'href' => "friendrequests", - 'contexts' => array('friends'), - ); - elgg_register_menu_item('page', $params); - } - elgg_register_plugin_hook_handler('register', 'menu:topbar', 'friendrequest_topbar_menu'); + elgg_register_plugin_hook_handler('register', 'menu:page', 'friendrequest_page_menu'); //We need to override the friend remove action to remove the relationship we created $actions_dir = elgg_get_plugins_path().'friendrequest/actions/friends'; @@ -111,6 +101,22 @@ function friendrequest_topbar_menu($hook, $entity_type, $returnvalue, $params) { return $returnvalue; } +function friendrequest_page_menu($hook, $entity_type, $returnvalue, $params) { + if(elgg_in_context('friends')){ + foreach($returnvalue as $i => $item) { + if($item->getName() == 'friends:of') { + unset($returnvalue[$i]); + } + } + if (elgg_is_logged_in()) { + $count = friendrequest_count(); + $item = new ElggMenuItem('friendrequests', elgg_echo('friendrequest').($count? " ($count)": ""), "friendrequests"); + $returnvalue[] = $item; + } + } + return $returnvalue; +} + function friendrequest_event_create_friend($event, $object_type, $object){var_dump($object);elgg_echo('hola'); if (($object instanceof ElggRelationship) && ($event == 'create') && ($object_type == 'friend')) { //We don't want anything happening here... (no email/etc) |