You are here

function answers_best_answer_flag_unflag in Answers 7.4

Implements hook_flag_unflag().

Flag API 3

File

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

Code

function answers_best_answer_flag_unflag($flag, $content_id, $account, $flagging) {
  module_load_include('inc', 'answers', 'includes/answers.lock');
  if ($flag->name == "best_answer") {
    $flagged_answer = entity_metadata_wrapper('node', $content_id);
    $question = answers_answer_question($content_id);
    answers_question_lock_unset($question, 'answers_best_answer');
    module_invoke_all('answers_best_answer_unset', $question, $flagged_answer
      ->value());
  }
}