You are here

function facebook_tracking_pixel_node_delete in Facebook Tracking Pixel 7

Same name and namespace in other branches
  1. 8 facebook_tracking_pixel.module \facebook_tracking_pixel_node_delete()

Implements hook_node_delete().

File

./facebook_tracking_pixel.module, line 939
facebook_tracking_pixel.module Facebook Tracking Module.

Code

function facebook_tracking_pixel_node_delete($node) {

  //  If the node being deleted has a path tracking item, disable the item.
  $result = db_select('facebook_tracking_pixel_events_path', 'c')
    ->fields('c')
    ->condition('event_path_system', 'node/' . $node->nid, '=')
    ->execute()
    ->fetchAssoc();
  if ($result) {

    // If a node exists then we update the DB to disable that item.
    db_update('facebook_tracking_pixel_events_path')
      ->fields([
      'event_enable' => 0,
    ])
      ->condition('event_id', $result['event_id'], '=')
      ->execute();
  }
}