/** * Create a wall activity for this user after posting an answer. * * @param CMA_AnswerThread $instance * @param CMA_Answer $answer */ static function answer_posted_activity(CMA_AnswerThread $instance, CMA_Answer $answer) { if (!$instance->isPublished()) { return; } else { if (!$answer->isApproved()) { return; } } $post = $instance->getPost(); $user_id = $answer->getAuthorId(); $permalink = $answer->getPermalink(); bp_activity_add(array('action' => sprintf(CMA::__('%s answered to the question "%s"'), bp_core_get_userlink($user_id), sprintf('<a href="%s">%s</a>', esc_attr($permalink), esc_html($instance->getTitle()))), 'content' => CMA_AnswerThread::lightContent($answer->getContent()), 'component' => self::COMPONENT, 'type' => 'answer_posted', 'primary_link' => $permalink, 'user_id' => $user_id, 'item_id' => $answer->getId())); }