function _faq_ask_set_faq_notification in FAQ_Ask 7
Same name and namespace in other branches
- 6.2 faq_ask.module \_faq_ask_set_faq_notification()
Helper function to set a notification associated with a node
Parameters
integer $nid: Node Id of the question to associate an e-mail address to
string $email: Email address to associate with the question and to send the notification to when answered
1 call to _faq_ask_set_faq_notification()
- faq_ask_node_insert in ./
faq_ask.module - Implementation of hook_node_insert()
File
- ./
faq_ask.module, line 747 - This module is an add-on to the FAQ module that allows users with the 'ask question' permission to create a question which will be queued for an 'expert' to answer.
Code
function _faq_ask_set_faq_notification($nid, $email) {
if (!$nid) {
drupal_set_message(t('Attempt to insert notification to @email for no node ID. Insert failed.', array(
'@email' => $email,
)), 'error');
return;
}
db_insert('faq_ask_notify')
->fields(array(
'nid' => $nid,
'email' => $email,
))
->execute();
// Does not work as the result of the execute() method on the query object is undefined
// or untrusted for tables without a AUTO_INCREMENT field. See http://drupal.org/node/310079
// if ($inserted == 0) {
// drupal_set_message(t('Attempt to insert email notification failed.'), 'error');
// }
}