function quotes_insert in Quotes 5
Same name and namespace in other branches
- 6 quotes.module \quotes_insert()
- 7 quotes.module \quotes_insert()
Implementation of hook_insert(). This inserts the quote-specific information into the quotes tables and also handles the %id variable in the node title.
1 call to quotes_insert()
- quotes_update in ./
quotes.module - Implementation of hook_update().
File
- ./
quotes.module, line 407
Code
function quotes_insert($node) {
$aid = _quotes_handle_author($node->quotes_author);
db_query("INSERT INTO {quotes} (nid, vid, aid, citation, promote) VALUES (%d, %d, '%d', '%s', %d)", $node->nid, $node->vid, $aid, $node->quotes_citation, $node->quotes_promote);
// replace %id variable in title
if (strpos($node->title, '%id') !== FALSE) {
$node->title = str_replace('%id', $node->nid, $node->title);
db_query("UPDATE {node} SET title = '%s' WHERE vid = %d", $node->title, $node->vid);
db_query("UPDATE {node_revisions} SET title = '%s' WHERE vid = %d", $node->title, $node->vid);
}
}