You are here

function _answers_question_answers in Answers 6.2

Same name and namespace in other branches
  1. 6 answers.module \_answers_question_answers()
  2. 7 answers.module \_answers_question_answers()
  3. 7.2 answers.module \_answers_question_answers()
  4. 7.3 answers.module \_answers_question_answers()

Gathers a list of answer NIDS for a given question.

Parameters

$question: Either a numeric node NID or a node object.

Return value

Returns an array of answer node NIDs.

1 call to _answers_question_answers()
answers_nodeapi in ./answers.module
Implements hook_nodeapi().

File

./answers.module, line 111

Code

function _answers_question_answers($question) {
  $results = array();
  $qid = is_object($question) ? $question->nid : $question;

  // Use views as a query engine
  $view = views_get_view('question_answers');
  $view
    ->set_arguments(array(
    $qid,
  ));
  $view
    ->execute();
  foreach ($view->result as $result) {
    $nid = $result->nid;
    $results[$nid] = $nid;
  }
  return $results;
}