function _quotes_handle_author in Quotes 5
Same name and namespace in other branches
- 6 quotes.module \_quotes_handle_author()
- 7 quotes.module \_quotes_handle_author()
Helper function to fetch or insert an author.
Parameters
$author: The text of the author's name.
@return The aid for the author in the quotes_authors table.
3 calls to _quotes_handle_author()
- quotes_delete in ./
quotes.module - Implementation of hook_delete().
- quotes_insert in ./
quotes.module - Implementation of hook_insert(). This inserts the quote-specific information into the quotes tables and also handles the %id variable in the node title.
- quotes_update in ./
quotes.module - Implementation of hook_update().
File
- ./
quotes.module, line 430
Code
function _quotes_handle_author($author) {
$aid = db_result(db_query("SELECT qa.aid FROM {quotes_authors} qa WHERE qa.name='%s'", $author));
if (empty($aid)) {
$result = db_query("INSERT INTO {quotes_authors} (name) VALUES ('%s')", $author);
if ($result === FALSE) {
drupal_set_message(t('Quotes: insert author failed.'), 'error');
}
$aid = db_result(db_query("SELECT aid FROM {quotes_authors} qa WHERE qa.name='%s'", $author));
if ($aid === FALSE) {
drupal_set_message(t('Quotes: get aid failed.'), 'error');
}
}
return $aid;
}