You are here

function answers_best_answer_settings_form_submit in Answers 7.4

Process best answer configuration settings.

1 string reference to 'answers_best_answer_settings_form_submit'
answers_best_answer_form_alter in answers_best_answer/answers_best_answer.module
Implements hook_form_alter().

File

answers_best_answer/answers_best_answer.module, line 93
Support selection of 'Best Answers' for the 'Answers' module.

Code

function answers_best_answer_settings_form_submit($form, &$form_state) {

  // Process the setting on locking questions.
  $new = $form_state['values']['answers_best_answer_lock_questions_p'];
  $old = $form_state['values']['answers_best_answer_old_lock_questions_p'];
  if ($old != $new) {
    module_load_include('inc', 'answers', 'includes/answers.lock');
    answers_reset_lock_info();
    drupal_set_message($new ? t('!Questions that have best answers have been locked.', answers_translation()) : t('!Questions that have best answers have been unlocked (unless they are locked for another reason)', answers_translation()));
  }

  // Process the setting on locking best answers when a question is locked.
  $new = $form_state['values']['answers_best_answer_lock_choice_p'];
  $old = $form_state['values']['answers_best_answer_old_lock_choice_p'];
  if ($old != $new) {
    drupal_set_message($new ? t('Best !answer has been locked.', answers_translation()) : t('Best !answer has been unlocked', answers_translation()));
  }
}