You are here

function quotes_delete in Quotes 6

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

Implementation of hook_delete().

File

./quotes.module, line 488
The quotes module allows users to maintain a list of quotes that can be displayed in any number of administrator-defined quote blocks.

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);
}