You are here

function user_relationships_delete_relationship in User Relationships 5

Same name and namespace in other branches
  1. 5.3 user_relationships_api/user_relationships_api.api.inc \user_relationships_delete_relationship()
  2. 5.2 user_relationships_api.inc \user_relationships_delete_relationship()
  3. 6 user_relationships_api/user_relationships_api.api.inc \user_relationships_delete_relationship()
  4. 7 user_relationships.module \user_relationships_delete_relationship()

Public API for deleting a relationship.

Parameters

$relationship: object of the relationship

$deleted_by: object of the user that initiated the delete command

$op: string reason for removal ('cancel','disapprove','remove')

3 calls to user_relationships_delete_relationship()
user_relationships_pending_requested_submit in ./user_relationships_actions.inc
Approve, Disapprove, or Cancel a relationship request
user_relationships_remove_submit in ./user_relationships_actions.inc
Remove a relationship
user_relationship_implications_user_relationships in plugins/user_relationship_implications/user_relationship_implications.module
hook_user_relationships()

File

./user_relationships_api.inc, line 256

Code

function user_relationships_delete_relationship(&$relationship, &$deleted_by, $op = 'remove') {
  $relationship->deleted_by = $deleted_by;
  db_query("DELETE FROM {user_relationships} WHERE rid = %d", $relationship->rid);
  cache_clear_all("user_relationships_relationship_{$relationship->rid}", 'cache_user_relationships');
  _user_relationships_invoke('delete', $relationship, $op);
  cache_clear_all("user_relationships_relationships_{$relationship->requester_id}", 'cache_user_relationships');
  cache_clear_all("user_relationships_relationships_{$relationship->requestee_id}", 'cache_user_relationships');
}