aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2011-12-10 01:24:32 +0100
committerSem <sembrestels@riseup.net>2011-12-10 01:24:32 +0100
commitb19fa6f54d89137ca55b3ddd343c5f22da16839a (patch)
treed324015d8311e1cb806dec4c48087bac52786b27
parente1081bd87837f5bf5fdbaf26b4b9bb8e50c61ff5 (diff)
downloadelgg-b19fa6f54d89137ca55b3ddd343c5f22da16839a.tar.gz
elgg-b19fa6f54d89137ca55b3ddd343c5f22da16839a.tar.bz2
Removed "Friends of" menu item.
-rw-r--r--start.php28
1 files changed, 17 insertions, 11 deletions
diff --git a/start.php b/start.php
index 4becf5efa..2ea3c80f9 100644
--- a/start.php
+++ b/start.php
@@ -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)