You are here

function answers_reset_question_locks in Answers 7.3

Same name and namespace in other branches
  1. 6.2 includes/answers.lock.inc \answers_reset_question_locks()
  2. 7.2 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 38
Question locking functions for the 'Answers' module.

Code

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