function anonymous_publishing_cl_entity_delete in Anonymous Publishing 7
Same name and namespace in other branches
- 8 modules/anonymous_publishing_cl/anonymous_publishing_cl.module \anonymous_publishing_cl_entity_delete()
Implements hook_entity_delete().
File
- modules/
cl/ anonymous_publishing_cl.module, line 885
Code
function anonymous_publishing_cl_entity_delete($entity, $type) {
$apid = NULL;
if ('node' == $type) {
$apid = db_query("SELECT apid FROM {anonymous_publishing} WHERE :nid = nid", array(
':nid' => $entity->nid,
))
->fetchField();
}
elseif ('comment' == $type) {
$apid = db_query("SELECT apid FROM {anonymous_publishing} WHERE :cid = cid", array(
':cid' => $entity->cid,
))
->fetchField();
}
if (!empty($apid)) {
db_delete('anonymous_publishing')
->condition('apid', $apid)
->execute();
}
}