/** * Action then the thread has been resolved. * * @param CMA_Thread $thread */ public function threadResolved(CMA_Thread $thread) { if (CMA_Settings::getOption(CMA_Settings::OPTION_MP_REWARD_BEST_ANSWER_ENABLE)) { if ($points = CMA_Settings::getOption(CMA_Settings::OPTION_MP_REWARD_BEST_ANSWER_POINTS)) { if ($thread->isResolved() and $bestAnswer = CMA_Answer::getById($thread->getBestAnswerId())) { if ($userId = $bestAnswer->getAuthorId() and $user = get_userdata($userId)) { if ($this->chargeUserWallet($userId, $points)) { add_filter('cma_question_resolved_msg_success', array($this, 'questionResolvedMessageSuccess')); add_filter('cma_question_mark_best_answer_msg_success', array($this, 'questionResolvedMessageSuccess')); } } } } } }