You are here

function answers_reset_question_locks in Answers 6.2

Same name and namespace in other branches
  1. 7.2 includes/answers.lock.inc \answers_reset_question_locks()
  2. 7.3 includes/answers.lock.inc \answers_reset_question_locks()

Cycle through all questions and reset their locks.

This can be required when a global policy is changed. For example, an administrator may change the policy in the Best Answers module to lock questions after a Best Answer is selected. When this happens, the module calls this function to update the locks.

File

includes/answers.lock.inc, line 34
Question locking functions for the 'Answers' module

Code

function answers_reset_question_locks() {
  $modules = module_implements('answers_lock_question_p');
  $query = db_query("SELECT * from {node} WHERE type = 'question';");
  while ($question = db_fetch_object($query)) {
    $question = node_load($question->nid);
    if (answers_lock_question_p($question, $modules)) {
      answers_lock_question($question);
    }
    else {
      answers_unlock_question($question);
    }
  }
}