- // Only delete if the contact doesn't exist (anymore)
- $r = dba::exists('contact', array('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)) {