revoke.php 457 B

12345678910111213141516171819
  1. <?php
  2. $friend_guid = (int) get_input('guid');
  3. $friend = get_user($friend_guid);
  4. if (empty($friend)) {
  5. register_error(elgg_echo('error:missing_data'));
  6. forward(REFERER);
  7. }
  8. $user = elgg_get_logged_in_user_entity();
  9. if (remove_entity_relationship($user->getGUID(), 'friendrequest', $friend->getGUID())) {
  10. system_message(elgg_echo('friend_request:revoke:success'));
  11. } else {
  12. register_error(elgg_echo('friend_request:revoke:fail'));
  13. }
  14. forward(REFERER);