- // Only delete if the contact doesn't exist (anymore)
- $r = DBA::exists('contact', ['id' => $id]);
- if ($r) {
+ // Only delete if the contact is to be deleted
+ $condition = ['network' => Protocol::PHANTOM, 'id' => $id];
+ $r = DBA::exists('contact', $condition);
+ if (!DBA::isResult($r)) {