remove.php 565 B

1234567891011121314151617181920212223242526
  1. <?php
  2. /**
  3. * Elgg remove friend action
  4. *
  5. * @package Elgg.Core
  6. * @subpackage Friends.Management
  7. */
  8. // Get the GUID of the user to friend
  9. $friend_guid = get_input('friend');
  10. $friend = get_user($friend_guid);
  11. if (!$friend) {
  12. register_error(elgg_echo('error:missing_data'));
  13. forward(REFERER);
  14. }
  15. if (!elgg_get_logged_in_user_entity()->removeFriend($friend->guid)) {
  16. register_error(elgg_echo("friends:remove:failure", array($friend->name)));
  17. forward(REFERER);
  18. }
  19. system_message(elgg_echo("friends:remove:successful", array($friend->name)));
  20. forward(REFERER);