From 3d06a9f35740be34ec36509f76d4ce874c80e808 Mon Sep 17 00:00:00 2001 From: Sem Date: Sat, 24 Aug 2013 12:04:08 +0200 Subject: Fixed add and remove friend actions. --- actions/friends/add.php | 8 +++++++- actions/friends/remove.php | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/actions/friends/add.php b/actions/friends/add.php index c464a8162..e6efe1db1 100644 --- a/actions/friends/add.php +++ b/actions/friends/add.php @@ -26,7 +26,13 @@ if(check_entity_relationship($friend->guid, "friendrequest", $user->guid) if (!$user->addFriend($friend_guid)) { $errors = true; } - remove_entity_relationship($friend->guid, "friendrequest", $user->guid); + + $ia = elgg_set_ignore_access(true); + $friend->addFriend($user->guid); + elgg_set_ignore_access($ia); + + remove_entity_relationship($friend->guid, "friendrequest", $user->guid); + } catch (Exception $e) { register_error(elgg_echo("friends:add:failure", array($friend->name))); $errors = true; diff --git a/actions/friends/remove.php b/actions/friends/remove.php index 936f6f43b..62bccb891 100644 --- a/actions/friends/remove.php +++ b/actions/friends/remove.php @@ -17,7 +17,7 @@ try{ if ($friend instanceof ElggUser) { elgg_get_logged_in_user_entity()->removeFriend($friend_guid); $ia = elgg_set_ignore_access(true); - $friend->removeFriend($elgg_get_logged_in_user_guid()); + $friend->removeFriend(elgg_get_logged_in_user_guid()); elgg_set_ignore_access($ia); } else { register_error(elgg_echo("friends:remove:failure", array($friend->name))); -- cgit v1.2.3