/**
  * Removes a user from this user's friends list
  *
  * @param int $friend_guid The GUID of the user to remove
  * @return true|false Depending on success
  */
 function removeFriend($friend_guid)
 {
     return user_remove_friend($this->getGUID(), $friend_guid);
 }
<?php

// Load Elgg engine
include_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php";
// make sure only logged in users can see this page
gatekeeper();
$goto_url = "select_content_items.php";
if ($_POST['add'] == 1) {
    user_add_friend($_POST['cont_it_id'], $_POST['cont_it_added_id']);
} else {
    user_remove_friend($_POST['cont_it_id'], $_POST['cont_it_added_id']);
}
$a = $_POST['cont_it_id'];
echo '<meta HTTP-EQUIV="refresh"  CONTENT="0;URL=' . $goto_url . '?cont_it_id=' . $a . '">';
Esempio n. 3
0
function pleio_api_delete_contact($contact_id)
{
    $user = elgg_get_logged_in_user_entity();
    $user_id = $user !== false ? $user->guid : 0;
    $contact_id = intval($contact_id);
    $contact = get_user($contact_id);
    if (user_remove_friend($user_id, $contact_id)) {
        try {
            //V1.1 - Old relationships might not have the 2 as friends...
            user_remove_friend($contact_id, $user_id);
        } catch (Exception $e) {
            //ignore
        }
        return new SuccessResult(elgg_echo("friends:remove:successful", array($contact->name)));
    } else {
        return new ErrorResult(elgg_echo("friends:remove:failure", array($contact->name)));
    }
}