I had the same question and found very little other than a list of Hooks with no parameters or additional data. After a number of hours of trial and error I did find a solution that worked for me and thought I would share here. In my case I ran the qsm_quiz_submitted hook which looks something like:
add_action(‘qsm_quiz_submitted’, ‘mmm_get_data’, 10, 4 );
function mmm_get_data( $results_array, $results_id, $qmn_quiz_options, $qmn_array_for_variables ) {
…Your code here to capture quiz data and do something with it. Note running an echo here will probably break the quiz plugin…
}
I found that the $qmn_array_for_variables array stored all of the quiz results data that I needed. For reference, here is an output of how that array is structured. I will leave it up to you to figure out how to grab the data you need. The second array will need to be looped through to get each question/answer. The ‘correct’ field lists if the answer was ‘correct’ or ‘incorrect’. All of the other fields are pretty self explanatory. Best of luck!
$qmn_array_for_variables = array (
'quiz_id' => '1',
'quiz_name' => 'test',
'quiz_system' => '0',
'quiz_payment_id' => '',
'user_ip' => '###.###.###.###',
'form_type' => '0',
'user_name' => 'Test Test',
'user_business' => 'None',
'user_email' => '[email protected]',
'user_phone' => '##########',
'user_id' => 0,
'timer' => 10,
'timer_ms' => 0,
'time_taken' => '05:14:21 PM 02/05/2023',
'contact' =>
array (
0 =>
array (
'label' => 'Name',
'value' => 'Test Test',
'use' => 'name',
'type' => 'text',
),
1 =>
array (
'label' => 'Email',
'value' => '[email protected]',
'use' => 'email',
'type' => 'email',
),
2 =>
array (
'label' => 'Phone',
'value' => '##########',
'use' => 'phone',
'type' => 'text',
),
),
'hidden_questions' => NULL,
'total_points' => 0,
'total_score' => ##.##,
'total_correct' => #,
'total_questions' => #,
'question_answers_display' => '',
'question_answers_array' =>
array (
0 =>
array (
0 => '',
1 => 'Submitted Answer',
2 => 'Correct Answer',
3 => '',
'user_answer' =>
array (
1 => 'Submitted Answer',
),
'correct_answer' =>
array (
0 => 'Correct Answer',
),
'correct' => 'correct',
'id' => '1',
'points' => 0,
'category' => '',
'multicategories' =>
array (
),
'question_type' => '0',
'question_title' => 'Test Question #1',
'user_compare_text' => '',
'case_sensitive' => '',
),
),
'total_possible_points' => #,
'total_attempted_questions' => #,
'minimum_possible_points' => #,
'comments' => '',
'response_saved' => 1,
'result_id' => ##,
'result_unique_id' => '######',
)