You are here

function _flag_content_delete in Flag 7.2

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_content_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
Callback function for user account cancellation or deletion.

File

./flag.module, line 737
The Flag module.

Code

function _flag_content_delete($entity_type, $entity_id, $fid = NULL) {
  $query_content = db_delete('flag_content')
    ->condition('content_type', $entity_type)
    ->condition('content_id', $entity_id);
  $query_counts = db_delete('flag_counts')
    ->condition('content_type', $entity_type)
    ->condition('content_id', $entity_id);
  if (isset($fid)) {
    $query_content
      ->condition('fid', $fid);
    $query_counts
      ->condition('fid', $fid);
  }
  $query_content
    ->execute();
  $query_counts
    ->execute();
}