Elgg  Version 1.11
add.php
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 
13 if (!$friend) {
14  register_error(elgg_echo('error:missing_data'));
16 }
17 
18 if (!elgg_get_logged_in_user_entity()->addFriend($friend->guid, true)) {
19  register_error(elgg_echo("friends:add:failure", array($friend->name)));
21 }
22 
23 system_message(elgg_echo("friends:add:successful", array($friend->name)));
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
$friend
Definition: add.php:11
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
Definition: elgglib.js:419
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
get_user($guid)
Get a user object from a GUID.
Definition: users.php:87
const REFERER
Definition: elgglib.php:1995
$friend_guid
Definition: add.php:10
elgg system_message
Wrapper function for system_messages.
Definition: elgglib.js:374
elgg register_error
Wrapper function for system_messages.
Definition: elgglib.js:383
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
Definition: sessions.php:32