Hi @curioelectro,
Could you please check and see whether the following snippet helps?
<?php
add_filter( 'forminator_addon_activecampaign_contact_sync_args', 'wpmudev_tags_assign_activec_quiz', 10, 6 );
function wpmudev_tags_assign_activec_quiz( $args, $quiz_id, $connection_id, $submitted_data, $connection_settings, $quiz_settings_instance ) {
if ( 45660 !== intval( $quiz_id ) ) { // Please change the quiz ID.
return $args;
}
$model = Forminator_Base_Form_Model::get_model( $quiz_id );
$results = array();
if ( isset( Forminator_Quiz_Front_Action::$prepared_data['answers'] ) ) {
foreach ( Forminator_Quiz_Front_Action::$prepared_data['answers'] as $id => $answer ) {
$results[] = $model->getResultFromAnswer( $id, $answer );
}
}
$answer_results = array_count_values( $results );
$final_res = $model->get_nowrong_result( $answer_results );
if ( ! empty( $final_res['title'] ) ) {
$args['tags'] = $final_res['title'];
}
return $args;
}
In the above snippet, you’ll need to update 45660 with your Quiz ID and make sure to leave the tags field empty in Active campaign integration, so that the code will add the tags. Please check and let us know whether it works.
You can implement the above code using mu-plugins. Please check this link on how to implement the above code as a mu-plugins:
https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins
Kind Regards,
Nithin