From f14c7d977d57e7a2cca8bff8931a56fe405cf50c Mon Sep 17 00:00:00 2001 From: Sem Date: Thu, 8 Dec 2011 18:48:23 +0100 Subject: Add friend refactored. --- actions/friends/add.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 actions/friends/add.php (limited to 'actions') diff --git a/actions/friends/add.php b/actions/friends/add.php new file mode 100644 index 000000000..702a384d3 --- /dev/null +++ b/actions/friends/add.php @@ -0,0 +1,24 @@ +guid, "friendrequest", $user->guid) + || check_entity_relationship($friend->guid, "friend", $user->guid)) { + $user->addFriend($friend->guid); + remove_entity_relationship($friend->guid, "friendrequest", $user->guid); + + system_message(elgg_echo("friends:add:successful", array($friend->name))); + +} elseif(add_entity_relationship($user->guid, "friendrequest", $friend->guid)) { + system_message(elgg_echo("friendrequest:add:successful", array($friend->name))); +} else { + register_error(elgg_echo("friendrequest:add:exists", array($friend->name))); +} + +forward(REFERER); -- cgit v1.2.3