You are here

function _answers_set_default_question_field_values in Answers 7.2

1 call to _answers_set_default_question_field_values()
answers_update_7201 in ./answers.install
Make sure that custom question fields have values set. If one doesn't, set the default value.

File

./answers.install, line 47

Code

function _answers_set_default_question_field_values($question) {
  $changed_p = FALSE;
  if (isset($question->field_answer_count['und'][0]['count'])) {
    $question->field_question_locked_p['und'][0]['count'] = 0;
    $changed_p = TRUE;
  }
  if (isset($question->field_notify_p['und'][0]['value'])) {
    $question->field_notify_p['und'][0]['value'] = 0;
    $changed_p = TRUE;
  }
  if (isset($question->field_question_locked_p['und'][0]['value'])) {
    $question->field_question_locked_p['und'][0]['value'] = 0;
    $changed_p = TRUE;
  }
  if ($changed_p) {
    watchdog('answers', 'Set default question fields for nid ' . $question->nid);
    node_save($question);
  }
}