From f14c7d977d57e7a2cca8bff8931a56fe405cf50c Mon Sep 17 00:00:00 2001 From: Sem Date: Thu, 8 Dec 2011 18:48:23 +0100 Subject: Add friend refactored. --- start.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'start.php') diff --git a/start.php b/start.php index 744a3ef84..0b38a341d 100644 --- a/start.php +++ b/start.php @@ -27,7 +27,9 @@ function friendrequest_init() { elgg_register_action('friendrequest/decline', "$actions_dir/decline.php"); //We need to override the friend remove action to remove the relationship we created - elgg_register_action('friends/remove', "$actions_dir/removefriend.php"); + $actions_dir = elgg_get_plugins_path().'friendrequest/actions/friends'; + elgg_register_action('friends/add', "$actions_dir/add.php"); + elgg_register_action('friends/remove', "$actions_dir/remove.php"); //Regular Elgg engine sends out an email via an event. The 400 priority will let us run first. //Then we return false to stop the event chain. The normal event handler will never get to run. @@ -58,10 +60,17 @@ function friendrequest_page_handler($page){ return true; } -function friendrequest_event_create_friend(){ - +function friendrequest_event_create_friend($event, $object_type, $object){ + if (($object instanceof ElggRelationship) && ($event == 'create') && ($object_type == 'friend')) { + //We don't want anything happening here... (no email/etc) + + //Returning false will interrupt the rest of the chain. + //The normal handler for the create friend event has a priority of 500 so it will never be called. + return false; + } + return true; //Shouldn't get here... } -function friendrequest_event_create_friendrequest(){ +function friendrequest_event_create_friendrequest($event, $object_type, $object){ } -- cgit v1.2.3