function _flag_entity_delete in Flag 7.3
Deletes flagging records for the entity.
Parameters
$entity_type: The type of the entity being deleted; e.g. 'node' or 'comment'.
$entity_id: The ID of the entity being deleted.
$fid: The flag id
3 calls to _flag_entity_delete()
- flag_entity_delete in ./
flag.module - Implements hook_entity_delete().
- flag_node_delete in ./
flag.module - Implements hook_node_delete().
- flag_user_account_removal in ./
flag.module - Shared helper for user account cancellation or deletion.
File
- ./
flag.module, line 1110 - The Flag module.
Code
function _flag_entity_delete($entity_type, $entity_id, $fid = NULL) {
$query_content = db_delete('flagging')
->condition('entity_type', $entity_type)
->condition('entity_id', $entity_id);
$query_counts = db_delete('flag_counts')
->condition('entity_type', $entity_type)
->condition('entity_id', $entity_id);
if (isset($fid)) {
$query_content
->condition('fid', $fid);
$query_counts
->condition('fid', $fid);
}
$query_content
->execute();
$query_counts
->execute();
}