You are here

function quotes_update in Quotes 5

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

Implementation of hook_update().

File

./quotes.module, line 448

Code

function quotes_update($node) {
  global $user;
  $aid = _quotes_handle_author($node->quotes_author);
  if ($node->revision) {
    quotes_insert($node);
  }
  else {
    $result = db_query("UPDATE {quotes} q SET q.aid='%d', q.citation='%s', q.promote=%d WHERE q.nid=%d AND q.vid=%d", $aid, $node->quotes_citation, $node->quotes_promote, $node->nid, $node->vid);
    if ($result === FALSE) {
      drupal_set_message(t('Quotes update failed.'), 'error');
    }
  }
}