You are here

function quotes_delete in Quotes 5

Same name and namespace in other branches
  1. 6 quotes.module \quotes_delete()
  2. 7 quotes.module \quotes_delete()

Implementation of hook_delete().

File

./quotes.module, line 466

Code

function quotes_delete($node) {
  $aid = _quotes_handle_author($node->quotes_author);

  // If this is the last quote using this author, then delete the author too.
  $aid_count = db_result(db_query("SELECT COUNT(q.nid) FROM {quotes} q WHERE q.aid='%d'", $aid));
  if ($aid_count == 1) {
    db_query("DELETE FROM {quotes_authors} WHERE aid = %d", $aid);
  }
  db_query("DELETE FROM {quotes} WHERE nid = %d", $node->nid);
}