Elgg  Version 1.9
Go to the documentation of this file.
1 <?php
9 // Get the GUID of the user to friend
10 $friend_guid = get_input('friend');
12 $errors = false;
14 // Get the user
15 try{
16  if ($friend instanceof ElggUser) {
18  } else {
19  register_error(elgg_echo("friends:remove:failure", array($friend->name)));
20  $errors = true;
21  }
22 } catch (Exception $e) {
23  register_error(elgg_echo("friends:remove:failure", array($friend->name)));
24  $errors = true;
25 }
27 if (!$errors) {
28  system_message(elgg_echo("friends:remove:successful", array($friend->name)));
29 }
31 // Forward back to the page you made the friend on
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
Definition: metadata.php:12
Definition: remove.php:10
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
Definition: elgglib.js:419
Definition: remove.php:11
Definition: remove.php:12
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
Definition: elgglib.php:2162
elgg system_message
Wrapper function for system_messages.
Definition: elgglib.js:374
elgg register_error
Wrapper function for system_messages.
Definition: elgglib.js:383
Return the current logged in user, or null if no user is logged in.
Definition: sessions.php:32
Loads and returns an entity object from a guid.
Definition: entities.php:604