You are here

function faq_update in Frequently Asked Questions 7.2

Same name and namespace in other branches
  1. 5.2 faq.module \faq_update()
  2. 6 faq.module \faq_update()
  3. 7 faq.module \faq_update()

Implements hook_update().

Updates the faq node question text in the 'faq_questions' table.

Parameters

$node: The node object.

File

./faq.module, line 301
The FAQ module allows users to create a FAQ page, with questions and answers displayed in different styles, according to the settings.

Code

function faq_update($node) {
  if (isset($node->revision) && $node->revision) {
    faq_insert($node);
  }
  else {

    // Just to be safe, we do a merge query instead of an update query.
    db_merge('faq_questions')
      ->fields(array(
      'question' => $node->title,
      'detailed_question' => $node->detailed_question,
    ))
      ->key(array(
      'nid' => $node->nid,
      'vid' => $node->vid,
    ))
      ->execute();
  }
}