function faq_ask_answer in FAQ_Ask 6
Same name and namespace in other branches
- 6.2 faq_ask.module \faq_ask_answer()
- 7 faq_ask.module \faq_ask_answer()
This function is called when an expert selects a question to answer. It changes the status option to "published" then goes to the regular FAQ edit function.
1 string reference to 'faq_ask_answer'
- faq_ask_menu in ./
faq_ask.module - Implementation of hook_menu().
File
- ./
faq_ask.module, line 826 - 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_answer($node) {
global $user;
$reassign_opt = variable_get('faq_ask_expert_own', 0);
// Check if we need to reassign to the expert.
switch ($reassign_opt) {
case 0:
// Do not reassign.
break;
case 1:
// Reassign if anonymous.
if ($node->uid == 0) {
faq_ask_reassign($node);
}
break;
case 2:
// Always reassign.
faq_ask_reassign($node);
break;
}
// Change the status to published and the user id, if needed.
db_query("UPDATE {node} SET status=1, uid=%d WHERE nid=%d", $node->uid, $node->nid);
// Need to invoke node/##/edit.
drupal_goto('node/' . $node->nid . '/edit');
}